1 | <?php |
||
12 | class HooksReader { |
||
13 | |||
14 | /** |
||
15 | * Construct a new HooksReader instance. |
||
16 | */ |
||
17 | 3 | private function __construct() { |
|
23 | |||
24 | /** |
||
25 | * Get the Annotation reader. |
||
26 | * |
||
27 | * @return AnnotationReader |
||
28 | */ |
||
29 | 30 | private function reader() { |
|
32 | |||
33 | /** |
||
34 | * Get the shared reader instance. |
||
35 | * |
||
36 | * @return HooksReader |
||
37 | */ |
||
38 | 30 | static private function instance() { |
|
47 | |||
48 | /** |
||
49 | * Shared implementation of hook reading logic. |
||
50 | * |
||
51 | * @param object $target Object to read annotations from. |
||
52 | * @param \Closure $condition Whether the annotation should be registered. |
||
53 | * @return array |
||
54 | */ |
||
55 | 30 | static public function read( $target, $condition ) { |
|
76 | } |
||
77 |
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: