1 | <?php |
||
5 | class FlagPermissionResolver extends FlagResolverAbstract implements FlagResolverInterface |
||
6 | { |
||
7 | /** |
||
8 | * @var int|null |
||
9 | */ |
||
10 | const DEFAULT_FLAG = null; |
||
11 | |||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | private $scope = ''; |
||
16 | |||
17 | /** |
||
18 | * @var array |
||
19 | */ |
||
20 | private $mapping = [ |
||
21 | 'user' => [ |
||
22 | 'w' => 128, |
||
23 | 'x' => 64, |
||
24 | 'r' => 256, |
||
25 | ], |
||
26 | 'group' => [ |
||
27 | 'w' => 16, |
||
28 | 'x' => 8, |
||
29 | 'r' => 32, |
||
30 | ], |
||
31 | 'universe' => [ |
||
32 | 'w' => 2, |
||
33 | 'x' => 1, |
||
34 | 'r' => 4, |
||
35 | ], |
||
36 | ]; |
||
37 | |||
38 | /** |
||
39 | * @override |
||
40 | * @inheritDoc |
||
41 | */ |
||
42 | public function resolve($flag, $flags = null, $mapping = null) |
||
57 | |||
58 | /** |
||
59 | * @override |
||
60 | * @inheritDoc |
||
61 | */ |
||
62 | protected function getFlags() |
||
66 | |||
67 | /** |
||
68 | * @override |
||
69 | * @inheritDoc |
||
70 | */ |
||
71 | protected function getMapping() |
||
75 | } |
||
76 |
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: