Bristol SU Support Package
Permission.php
Go to the documentation of this file.
1 <?php
2 
3 
5 
6 
8 
13 {
14 
20  private $ability;
21 
27  private $name;
28 
34  private $description;
35 
43  private $type;
44 
50  private $moduleAlias;
51 
59  private $moduleType;
60 
71  public function __construct(string $ability = '', string $name = '', string $description = '', string $type = 'global', ?string $alias = null, ?string $moduleType = null)
72  {
73  $this->setAbility($ability);
74  $this->setName($name);
76  $this->setType($type);
77  $this->setModuleAlias($alias);
78  $this->setModuleType($moduleType);
79  }
80 
86  public function getAbility(): string
87  {
88  return $this->ability;
89  }
90 
97  public function setAbility(string $ability)
98  {
99  $this->ability = $ability;
100  }
101 
107  public function getName(): string
108  {
109  return $this->name;
110  }
111 
118  public function setName(string $name)
119  {
120  $this->name = $name;
121  }
122 
128  public function getDescription(): string
129  {
130  return $this->description;
131  }
132 
139  public function setDescription(string $description)
140  {
141  $this->description = $description;
142  }
143 
149  public function getType(): string
150  {
151  return $this->type;
152  }
153 
160  public function setType(string $type)
161  {
162  $this->type = $type;
163  }
164 
170  public function getModuleAlias(): ?string
171  {
172  return $this->moduleAlias;
173  }
174 
181  public function setModuleAlias(?string $moduleAlias)
182  {
183  $this->moduleAlias = $moduleAlias;
184  }
185 
191  public function getModuleType(): ?string
192  {
193  return $this->moduleType;
194  }
195 
202  public function setModuleType(?string $moduleType)
203  {
204  $this->moduleType = $moduleType;
205  }
206 
212  public function toArray()
213  {
214  return [
215  'ability' => $this->getAbility(),
216  'name' => $this->getName(),
217  'description' => $this->getDescription(),
218  'type' => $this->getType(),
219  'alias' => $this->getModuleAlias(),
220  'module_type' => $this->getModuleType()
221  ];
222  }
223 
230  public function toJson($options = 0)
231  {
232  return json_encode($this->toArray(), $options);
233  }
234 
240  public function __toString()
241  {
242  return $this->toJson();
243  }
244 }
__construct(string $ability='', string $name='', string $description='', string $type='global', ?string $alias=null, ?string $moduleType=null)
Definition: Permission.php:71