1 | <?php |
||
11 | trait ClientHasGrantsTrait |
||
12 | { |
||
13 | protected $grants = []; |
||
14 | |||
15 | /** |
||
16 | * @return bool |
||
17 | */ |
||
18 | public function firstParty(): bool |
||
22 | |||
23 | /** |
||
24 | * @param string|array $grants |
||
25 | * @see GrantHelper::GRANT_TYPE_* |
||
26 | */ |
||
27 | 7 | public function addGrants($grants) |
|
32 | |||
33 | /** |
||
34 | * @param string|array $grants |
||
35 | * @see GrantHelper::GRANT_TYPE_* |
||
36 | */ |
||
37 | public function removeGrants($grants) |
||
44 | |||
45 | /** |
||
46 | * @return array |
||
47 | */ |
||
48 | 11 | public function getGrants(): array |
|
52 | |||
53 | /** |
||
54 | * @param array $grants |
||
55 | */ |
||
56 | 7 | public function setGrants(array $grants) |
|
61 | |||
62 | /** |
||
63 | * @param $grant |
||
64 | * @return bool |
||
65 | */ |
||
66 | public function handlesGrant($grant) |
||
70 | |||
71 | /** |
||
72 | * @param string $grant |
||
73 | * @return bool |
||
74 | * @see GrantHelper::GRANT_TYPE_* |
||
75 | */ |
||
76 | 1 | public function hasGrant(string $grant): bool |
|
80 | |||
81 | 7 | protected function updateGrantsDbField() |
|
85 | |||
86 | /** |
||
87 | * @param null $data |
||
88 | */ |
||
89 | 2 | protected function initGrantsFromDb($data = null) |
|
98 | } |
||
99 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: