FOSSology  4.4.0
Open Source License Compliance by Open Source Software
GroupPermission.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2023 Divij Sharma <divijs75@gmail.com>
4  SPDX-License-Identifier: GPL-2.0-only
5 */
10 namespace Fossology\UI\Api\Models;
11 
12 
14 {
19  private $perm;
24  private $groupPk;
29  private $groupName;
30 
36  public function __construct($perm, $groupPk, $groupName)
37  {
38  $this->perm = $perm;
39  $this->groupPk = $groupPk;
40  $this->groupName = $groupName;
41  }
42 
46  public function getPerm()
47  {
48  return $this->perm;
49  }
50 
54  public function getGroupPk()
55  {
56  return $this->groupPk;
57  }
58 
62  public function getGroupName()
63  {
64  return $this->groupName;
65  }
66 
67 
68 
74  public function getJSON($version=ApiVersion::V1)
75  {
76  return json_encode($this->getArray($version));
77  }
78 
84  public function getArray($version=ApiVersion::V1)
85  {
86  if ($version == ApiVersion::V2) {
87  return [
88  'perm' => $this->getPerm(),
89  'groupPk' => $this->getGroupPk(),
90  'groupName' => $this->getGroupName()
91  ];
92  }
93  return [
94  'perm' => $this->getPerm(),
95  'group_pk' => $this->getGroupPk(),
96  'group_name' => $this->getGroupName()
97  ];
98  }
99 
103  public function setperm($perm)
104  {
105  $this->perm = $perm;
106  }
107 
111  public function setGroupPk($groupPk)
112  {
113  $this->groupPk = $groupPk;
114  }
115 
119  public function setGroupName($groupName)
120  {
121  $this->groupName = $groupName;
122  }
123 }
__construct($perm, $groupPk, $groupName)