1 | <?php |
||
22 | class ChainLoader implements LoaderInterface |
||
23 | { |
||
24 | protected $loaders = []; |
||
25 | |||
26 | /** |
||
27 | * Adds a loader instance. |
||
28 | * |
||
29 | * @param LoaderInterface $loader A Loader instance |
||
30 | */ |
||
31 | public function addLoader(LoaderInterface $loader) |
||
39 | |||
40 | /** |
||
41 | * @param LoaderInterface $loader |
||
42 | * |
||
43 | * @return bool |
||
44 | */ |
||
45 | public function removeLoader(LoaderInterface $loader) |
||
55 | |||
56 | /** |
||
57 | * Loads a Meta class from given datasource. |
||
58 | * |
||
59 | * @param string $type object type |
||
60 | * @param array|null $parameters parameters needed to load required object type |
||
61 | * @param int $responseType response type: single meta (LoaderInterface::SINGLE) or collection of metas (LoaderInterface::COLLECTION) |
||
62 | * |
||
63 | * @return Meta|bool false if meta cannot be loaded, a Meta instance otherwise |
||
64 | */ |
||
65 | public function load($type, $parameters = [], $responseType = LoaderInterface::SINGLE) |
||
77 | |||
78 | /** |
||
79 | * Checks if Loader supports provided type. |
||
80 | * |
||
81 | * @param string $type |
||
82 | * |
||
83 | * @return bool |
||
84 | */ |
||
85 | public function isSupported(string $type): bool |
||
95 | } |
||
96 |