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 | * Constructor |
||
42 | * |
||
43 | * @param string $cacheDirectory |
||
44 | * @param array|string $directories |
||
45 | * @param LoaderInterface[]|array $loaders |
||
46 | */ |
||
47 | public function __construct($cacheDirectory, $directories = null, array $loaders = []) |
||
56 | |||
57 | /** |
||
58 | * Get cache directory |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | public function getCacheDirectory() |
||
66 | |||
67 | /** |
||
68 | * Set cache directory |
||
69 | * |
||
70 | * @param string $cacheDirectory |
||
71 | * |
||
72 | * @return FileLoader |
||
73 | */ |
||
74 | public function setCacheDirectory($cacheDirectory) |
||
80 | |||
81 | /** |
||
82 | * Get directories |
||
83 | * |
||
84 | * @return array |
||
85 | */ |
||
86 | public function getDirectories() |
||
90 | |||
91 | /** |
||
92 | * Set directories |
||
93 | * |
||
94 | * @param array $directories |
||
95 | * |
||
96 | * @return FileLoader |
||
97 | */ |
||
98 | public function setDirectories(array $directories) |
||
104 | |||
105 | /** |
||
106 | * Add directory |
||
107 | * |
||
108 | * @param string $directory |
||
109 | * |
||
110 | * @return FileLoader |
||
111 | */ |
||
112 | public function addDirectory($directory) |
||
120 | |||
121 | /** |
||
122 | * Get Loaders |
||
123 | * |
||
124 | * @return LoaderInterface[]|array |
||
125 | */ |
||
126 | public function getLoaders() |
||
130 | |||
131 | /** |
||
132 | * Add loader |
||
133 | * |
||
134 | * @param LoaderInterface $loader |
||
135 | * |
||
136 | * @return FileLoader |
||
137 | */ |
||
138 | public function addLoader(LoaderInterface $loader) |
||
144 | |||
145 | /** |
||
146 | * Load from file |
||
147 | * |
||
148 | * @param string $fileName |
||
149 | * @param bool $refresh |
||
150 | * |
||
151 | * @return array |
||
152 | * @throws \Symfony\Component\Config\Exception\FileLoaderLoadException |
||
153 | */ |
||
154 | public function load($fileName, $refresh = false) |
||
177 | |||
178 | /** |
||
179 | * Load from file and apply configuration |
||
180 | * |
||
181 | * @param string $fileName |
||
182 | * @param ConfigurationInterface $configuration |
||
183 | * @param bool $refresh |
||
184 | * |
||
185 | * @return array |
||
186 | */ |
||
187 | public function loadWithConfiguration($fileName, ConfigurationInterface $configuration, $refresh = false) |
||
214 | } |
||
215 |
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.