1 | <?php |
||
26 | class DirectoryLoader extends AbstractLoader |
||
27 | { |
||
28 | /** |
||
29 | * Construct the loader with the passed entity |
||
30 | * |
||
31 | * @param string $entity The passed entity |
||
32 | * @param bool $recursive Search the directories recursively |
||
33 | */ |
||
34 | 7 | public function __construct($entity, $recursive) |
|
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | */ |
||
43 | 7 | public function load() |
|
57 | |||
58 | /** |
||
59 | * Returns the supported files in the directory recursively |
||
60 | * |
||
61 | * @return \RegexIterator The supported files in the directories |
||
62 | */ |
||
63 | 2 | private function getSupportedFilesRecursively() |
|
75 | |||
76 | /** |
||
77 | * Returns the supported files in the directory |
||
78 | * |
||
79 | * @return \RegexIterator The supported files in the directory |
||
80 | */ |
||
81 | 5 | private function getSupportedFiles() |
|
87 | |||
88 | /** |
||
89 | * Returns the supported files in the directory |
||
90 | * |
||
91 | * @param \FilesystemIterator|\RecursiveIteratorIterator $files The found files in the directory/ies |
||
92 | * |
||
93 | * @return \RegexIterator The supported files in the directory using the regexiterator |
||
94 | */ |
||
95 | 7 | private function createRegexIterator($files) |
|
102 | |||
103 | /** |
||
104 | * Makes usable resource paths from path strings |
||
105 | * |
||
106 | * @param array $paths The path strings |
||
107 | * |
||
108 | * @return array|bool The usable resources if any, else false |
||
109 | */ |
||
110 | 7 | private function makeResources($paths) |
|
124 | } |
||
125 |
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: