1 | <?php |
||
9 | class LoaderManager |
||
10 | { |
||
11 | /** |
||
12 | * @var Loader[] |
||
13 | */ |
||
14 | private $loaders = []; |
||
15 | |||
16 | /** |
||
17 | * @param Loader[] $loaders |
||
18 | */ |
||
19 | 172 | public function __construct(array $loaders = []) |
|
31 | |||
32 | /** |
||
33 | * Register a Loader for the given prefix. |
||
34 | * |
||
35 | * @param string $prefix |
||
36 | * @param Loader $loader |
||
37 | */ |
||
38 | 126 | public function registerLoader($prefix, Loader $loader) |
|
42 | |||
43 | /** |
||
44 | * Get all registered loaders, keyed by the prefix they are registered to load schemas for. |
||
45 | * |
||
46 | * @return Loader[] |
||
47 | */ |
||
48 | 2 | public function getLoaders() |
|
52 | |||
53 | /** |
||
54 | * Get the loader for the given prefix. |
||
55 | * |
||
56 | * @param string $prefix |
||
57 | * |
||
58 | * @return Loader |
||
59 | * @throws \InvalidArgumentException |
||
60 | */ |
||
61 | 48 | public function getLoader($prefix) |
|
69 | |||
70 | /** |
||
71 | * @param string $prefix |
||
72 | * |
||
73 | * @return bool |
||
74 | */ |
||
75 | 50 | public function hasLoader($prefix) |
|
79 | |||
80 | /** |
||
81 | * Register the default file loader. |
||
82 | */ |
||
83 | 170 | private function registerDefaultFileLoader() |
|
87 | |||
88 | /** |
||
89 | * Register the default web loaders. If the curl extension is loaded, |
||
90 | * the CurlWebLoader will be used. Otherwise the FileGetContentsWebLoader |
||
91 | * will be used. You can override this by registering your own loader |
||
92 | * for the 'http' and 'https' protocols. |
||
93 | */ |
||
94 | 170 | private function registerDefaultWebLoaders() |
|
104 | } |
||
105 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.