1 | <?php |
||
12 | class ClassLoader |
||
13 | { |
||
14 | |||
15 | /** |
||
16 | * @internal |
||
17 | * @var ClassLoader |
||
18 | */ |
||
19 | private static $instance; |
||
20 | |||
21 | /** |
||
22 | * @var array Map of 'instance' (ClassManifest) and other options. |
||
23 | */ |
||
24 | protected $manifests = array(); |
||
25 | |||
26 | /** |
||
27 | * @return ClassLoader |
||
28 | */ |
||
29 | public static function inst() |
||
30 | { |
||
31 | return self::$instance ? self::$instance : self::$instance = new self(); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * Returns the currently active class manifest instance that is used for |
||
36 | * loading classes. |
||
37 | * |
||
38 | * @return ClassManifest |
||
39 | */ |
||
40 | public function getManifest() |
||
44 | |||
45 | /** |
||
46 | * Returns true if this class loader has a manifest. |
||
47 | */ |
||
48 | public function hasManifest() |
||
52 | |||
53 | /** |
||
54 | * Pushes a class manifest instance onto the top of the stack. |
||
55 | * |
||
56 | * @param ClassManifest $manifest |
||
57 | * @param bool $exclusive Marks the manifest as exclusive. If set to FALSE, will |
||
58 | * look for classes in earlier manifests as well. |
||
59 | */ |
||
60 | public function pushManifest(ClassManifest $manifest, $exclusive = true) |
||
64 | |||
65 | /** |
||
66 | * @return ClassManifest |
||
67 | */ |
||
68 | public function popManifest() |
||
73 | |||
74 | public function registerAutoloader() |
||
78 | |||
79 | /** |
||
80 | * Loads a class or interface if it is present in the currently active |
||
81 | * manifest. |
||
82 | * |
||
83 | * @param string $class |
||
84 | * @return String |
||
85 | */ |
||
86 | public function loadClass($class) |
||
93 | |||
94 | /** |
||
95 | * Returns the path for a class or interface in the currently active manifest, |
||
96 | * or any previous ones if later manifests aren't set to "exclusive". |
||
97 | * |
||
98 | * @param string $class |
||
99 | * @return string|false |
||
100 | */ |
||
101 | public function getItemPath($class) |
||
115 | |||
116 | /** |
||
117 | * Returns true if a class or interface name exists in the manifest. |
||
118 | * |
||
119 | * @param string $class |
||
120 | * @return bool |
||
121 | */ |
||
122 | public function classExists($class) |
||
127 | } |
||
128 |