1 | <?php |
||
23 | class Loader implements LoaderInterface |
||
24 | { |
||
25 | |||
26 | |||
27 | /** |
||
28 | * @var LoaderInterface $new_loader |
||
29 | */ |
||
30 | private $new_loader; |
||
31 | |||
32 | |||
33 | /** |
||
34 | * @var LoaderInterface $shared_loader |
||
35 | */ |
||
36 | private $shared_loader; |
||
37 | |||
38 | |||
39 | |||
40 | /** |
||
41 | * Loader constructor. |
||
42 | * |
||
43 | * @param LoaderInterface|null $new_loader |
||
44 | * @param LoaderInterface|null $shared_loader |
||
45 | * @throws InvalidInterfaceException |
||
46 | * @throws InvalidArgumentException |
||
47 | * @throws InvalidDataTypeException |
||
48 | */ |
||
49 | public function __construct(LoaderInterface $new_loader = null, LoaderInterface $shared_loader = null) |
||
54 | |||
55 | |||
56 | |||
57 | /** |
||
58 | * @param LoaderInterface|null $new_loader |
||
59 | * @return CoreLoader|LoaderInterface |
||
60 | * @throws InvalidArgumentException |
||
61 | */ |
||
62 | private function setupNewLoader(LoaderInterface $new_loader = null) |
||
70 | |||
71 | |||
72 | |||
73 | /** |
||
74 | * @param LoaderInterface|null $shared_loader |
||
75 | * @return CoreLoader|LoaderInterface |
||
76 | * @throws InvalidDataTypeException |
||
77 | * @throws InvalidInterfaceException |
||
78 | * @throws InvalidArgumentException |
||
79 | */ |
||
80 | private function setupSharedLoader(LoaderInterface $shared_loader = null) |
||
91 | |||
92 | |||
93 | |||
94 | /** |
||
95 | * @return LoaderInterface |
||
96 | */ |
||
97 | public function getNewLoader() |
||
101 | |||
102 | |||
103 | |||
104 | /** |
||
105 | * @return LoaderInterface |
||
106 | */ |
||
107 | public function getSharedLoader() |
||
111 | |||
112 | |||
113 | |||
114 | /** |
||
115 | * @param string $fqcn |
||
116 | * @param array $arguments |
||
117 | * @param bool $shared |
||
118 | * @return mixed |
||
119 | */ |
||
120 | public function load($fqcn, $arguments = array(), $shared = true) |
||
126 | |||
127 | |||
128 | |||
129 | /** |
||
130 | * @param string $fqcn |
||
131 | * @param array $arguments |
||
132 | * @return mixed |
||
133 | */ |
||
134 | public function getNew($fqcn, $arguments = array()) |
||
138 | |||
139 | |||
140 | |||
141 | /** |
||
142 | * @param string $fqcn |
||
143 | * @param array $arguments |
||
144 | * @return mixed |
||
145 | */ |
||
146 | public function getShared($fqcn, $arguments = array()) |
||
150 | |||
151 | |||
152 | |||
153 | /** |
||
154 | * calls reset() on loaders if that method exists |
||
155 | */ |
||
156 | public function reset() |
||
161 | |||
162 | } |
||
163 | // End of file Loader.php |
||
164 | // Location: EventEspresso\core\services\loaders/Loader.php |