| 1 | <?php |
||
| 8 | class ModuleLoader |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var self |
||
| 12 | */ |
||
| 13 | private static $instance; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var ModuleManifest[] Module manifests |
||
| 17 | */ |
||
| 18 | protected $manifests = array(); |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @return self |
||
| 22 | */ |
||
| 23 | public static function instance() |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Get module by name from the current manifest. |
||
| 30 | * Alias for ::instance()->getManifest()->getModule() |
||
| 31 | * |
||
| 32 | * @param string $module |
||
| 33 | * @return Module |
||
| 34 | */ |
||
| 35 | public static function getModule($module) |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Returns the currently active class manifest instance that is used for |
||
| 42 | * loading classes. |
||
| 43 | * |
||
| 44 | * @return ModuleManifest |
||
| 45 | */ |
||
| 46 | public function getManifest() |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Returns true if this class loader has a manifest. |
||
| 53 | * |
||
| 54 | * @return bool |
||
| 55 | */ |
||
| 56 | public function hasManifest() |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Pushes a module manifest instance onto the top of the stack. |
||
| 63 | * |
||
| 64 | * @param ModuleManifest $manifest |
||
| 65 | */ |
||
| 66 | public function pushManifest(ModuleManifest $manifest) |
||
| 70 | |||
| 71 | /** |
||
| 72 | * @return ModuleManifest |
||
| 73 | */ |
||
| 74 | public function popManifest() |
||
| 78 | |||
| 79 | /** |
||
| 80 | * Check number of manifests |
||
| 81 | * |
||
| 82 | * @return int |
||
| 83 | */ |
||
| 84 | public function countManifests() |
||
| 88 | } |
||
| 89 |