1 | <?php |
||
23 | class FileLoader |
||
24 | { |
||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | private $cacheDirectory; |
||
29 | |||
30 | /** |
||
31 | * @var array |
||
32 | */ |
||
33 | private $directories; |
||
34 | |||
35 | /** |
||
36 | * @var LoaderInterface[]|array |
||
37 | */ |
||
38 | private $loaders = []; |
||
39 | |||
40 | /** |
||
41 | * @var bool |
||
42 | */ |
||
43 | private $debug; |
||
44 | |||
45 | /** |
||
46 | * Constructor |
||
47 | * |
||
48 | * @param string $cacheDirectory |
||
49 | * @param array|string $directories |
||
50 | * @param LoaderInterface[]|array $loaders |
||
51 | * @param bool $debug |
||
52 | */ |
||
53 | public function __construct($cacheDirectory, $directories = null, array $loaders = [], $debug = false) |
||
63 | |||
64 | /** |
||
65 | * Get cache directory |
||
66 | * |
||
67 | * @return string |
||
68 | */ |
||
69 | public function getCacheDirectory() |
||
73 | |||
74 | /** |
||
75 | * Set cache directory |
||
76 | * |
||
77 | * @param string $cacheDirectory |
||
78 | * |
||
79 | * @return FileLoader |
||
80 | */ |
||
81 | public function setCacheDirectory($cacheDirectory) |
||
87 | |||
88 | /** |
||
89 | * Get Debug |
||
90 | * |
||
91 | * @return bool |
||
92 | */ |
||
93 | public function isDebug() |
||
97 | |||
98 | /** |
||
99 | * Set Debug |
||
100 | * |
||
101 | * @param bool $debug |
||
102 | * |
||
103 | * @return FileLoader |
||
104 | */ |
||
105 | public function setDebug($debug) |
||
111 | |||
112 | /** |
||
113 | * Get directories |
||
114 | * |
||
115 | * @return array |
||
116 | */ |
||
117 | public function getDirectories() |
||
121 | |||
122 | /** |
||
123 | * Set directories |
||
124 | * |
||
125 | * @param array $directories |
||
126 | * |
||
127 | * @return FileLoader |
||
128 | */ |
||
129 | public function setDirectories(array $directories) |
||
135 | |||
136 | /** |
||
137 | * Add directory |
||
138 | * |
||
139 | * @param string $directory |
||
140 | * |
||
141 | * @return FileLoader |
||
142 | */ |
||
143 | public function addDirectory($directory) |
||
151 | |||
152 | /** |
||
153 | * Get Loaders |
||
154 | * |
||
155 | * @return LoaderInterface[]|array |
||
156 | */ |
||
157 | public function getLoaders() |
||
161 | |||
162 | /** |
||
163 | * Add loader |
||
164 | * |
||
165 | * @param LoaderInterface $loader |
||
166 | * |
||
167 | * @return FileLoader |
||
168 | */ |
||
169 | public function addLoader(LoaderInterface $loader) |
||
175 | |||
176 | /** |
||
177 | * Load from file |
||
178 | * |
||
179 | * @param string $fileName |
||
180 | * @param bool $refresh |
||
181 | * |
||
182 | * @return array |
||
183 | * @throws \Symfony\Component\Config\Exception\FileLoaderLoadException |
||
184 | */ |
||
185 | public function load($fileName, $refresh = false) |
||
208 | |||
209 | /** |
||
210 | * Load from file and apply configuration |
||
211 | * |
||
212 | * @param string $fileName |
||
213 | * @param ConfigurationInterface $configuration |
||
214 | * @param bool $refresh |
||
215 | * |
||
216 | * @return array |
||
217 | */ |
||
218 | public function loadWithConfiguration($fileName, ConfigurationInterface $configuration, $refresh = false) |
||
243 | } |
||
244 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.