1 | <?php |
||
20 | class CallableRegistry |
||
21 | { |
||
22 | /** |
||
23 | * The callable repository |
||
24 | * |
||
25 | * @var CallableRepository |
||
26 | */ |
||
27 | public $xRepository; |
||
28 | |||
29 | /** |
||
30 | * The registered directories |
||
31 | * |
||
32 | * These are directories registered without a namespace. |
||
33 | * |
||
34 | * @var array |
||
35 | */ |
||
36 | protected $aDirectories = []; |
||
37 | |||
38 | /** |
||
39 | * Indicate if the registered directories are already parsed |
||
40 | * |
||
41 | * @var boolean |
||
42 | */ |
||
43 | protected $bParsedDirectories = false; |
||
44 | |||
45 | /** |
||
46 | * The registered namespaces |
||
47 | * |
||
48 | * These are the namespaces specified when registering directories. |
||
49 | * |
||
50 | * @var array |
||
51 | */ |
||
52 | protected $aNamespaces = []; |
||
53 | |||
54 | /** |
||
55 | * Indicate if the registered namespaces are already parsed |
||
56 | * |
||
57 | * @var boolean |
||
58 | */ |
||
59 | protected $bParsedNamespaces = false; |
||
60 | |||
61 | /** |
||
62 | * If the underscore is used as separator in js class names. |
||
63 | * |
||
64 | * @var boolean |
||
65 | */ |
||
66 | protected $bUsingUnderscore = false; |
||
67 | |||
68 | /** |
||
69 | * The Composer autoloader |
||
70 | * |
||
71 | * @var Autoloader |
||
72 | */ |
||
73 | private $xAutoloader = null; |
||
74 | |||
75 | /** |
||
76 | * The class constructor |
||
77 | * |
||
78 | * @param CallableRepository $xRepository |
||
79 | */ |
||
80 | public function __construct(CallableRepository $xRepository) |
||
91 | |||
92 | /** |
||
93 | * |
||
94 | * @param string $sDirectory The directory being registered |
||
95 | * @param array $aOptions The associated options |
||
96 | * |
||
97 | * @return void |
||
98 | */ |
||
99 | public function addDirectory($sDirectory, array $aOptions) |
||
109 | |||
110 | /** |
||
111 | * |
||
112 | * @param string $sNamespace The namespace of the directory being registered |
||
113 | * @param array $aOptions The associated options |
||
114 | * |
||
115 | * @return void |
||
116 | */ |
||
117 | public function addNamespace($sNamespace, array $aOptions) |
||
146 | |||
147 | /** |
||
148 | * Read classes from registered directories (without namespaces) |
||
149 | * |
||
150 | * @return void |
||
151 | */ |
||
152 | public function parseDirectories() |
||
185 | |||
186 | /** |
||
187 | * Read classes from registered directories (with namespaces) |
||
188 | * |
||
189 | * @return void |
||
190 | */ |
||
191 | public function parseNamespaces() |
||
234 | |||
235 | /** |
||
236 | * Find options for a class which is registered with namespace |
||
237 | * |
||
238 | * @param string $sClassName The class name |
||
239 | * |
||
240 | * @return array|null |
||
241 | */ |
||
242 | protected function getClassOptionsFromNamespaces($sClassName) |
||
264 | |||
265 | /** |
||
266 | * Find the options associated with a registered class name |
||
267 | * |
||
268 | * @param string $sClassName The class name |
||
269 | * |
||
270 | * @return array|null |
||
271 | */ |
||
272 | protected function getClassOptions($sClassName) |
||
287 | |||
288 | /** |
||
289 | * Find a callable object by class name |
||
290 | * |
||
291 | * @param string $sClassName The class name of the callable object |
||
292 | * |
||
293 | * @return object |
||
294 | */ |
||
295 | public function getCallableObject($sClassName) |
||
321 | } |
||
322 |