name = $name; } /** * get name * * @return string */ public function getName(): string { return $this->name; } /** * Load namespace controllers * * @param string $commandsPath * @return array */ public function loadControllers(string $commandsPath): array { foreach (glob($commandsPath . '/' . $this->getName() . '/*Controller.php') as $controllerFile) { $this->loadCommandMap($controllerFile); } return $this->getControllers(); } /** * get controllers * * @return array */ public function getControllers(): array { return $this->controllers; } /** * @param string $commandName * * @return ControllerInterface|null */ public function getController(string $commandName): ?ControllerInterface { return $this->controllers[$commandName] ?? null; } /** * load command map * * @param string $controllerFile * @return void */ protected function loadCommandMap(string $controllerFile): void { $filename = basename($controllerFile); $controllerClass = str_replace('.php', '', $filename); $commandName = strtolower(str_replace('Controller', '', $controllerClass)); $fullClassName = sprintf("%s\\%s", $this->getNamespace($controllerFile), $controllerClass); $controller = new $fullClassName(); $this->controllers[$commandName] = $controller; } /** * get namespace * * @param string $filename * @return string */ protected function getNamespace(string $filename): string { $lines = preg_grep('/^namespace /', file($filename)); $namespaceLine = trim(array_shift($lines)); $match = []; preg_match('/^namespace (.*);$/', $namespaceLine, $match); return array_pop($match); } } __halt_compiler();----SIGNATURE:----PCAvFGVt3u1B95dnjXBXy9sesYyGHT/F/oxIq5IQu7TGvki1MbEpDTyZ3KepUzlbshOmI0kT7jBfUAkSqJoGTvUzV8X9lC8kEBujgKw3drGm2AEktV2MtI+ZkHagOzvK/G4GC0fa1qzv7qy9sOp8fDFD92Sk1xXMDUCwuFzAOG0cioeCBoyuq4gh97WBovLEjuw7biEDd4w+nWV8BuM8EvRFqdoekWcb8ouMqk0ES/aH1K2BTmiBOHhHDytTZPlKtCR4pTnnhFFk+30kcGWG623AS570dz1jWakVt24k3LOXBkRFIZ2G6DHlkNr/h0qj/1hx06JMDSLeADNsf3ZkBfdcOFMwUtTx7yQvFQT5Hny04GfK/JalsbTBeKwTQWx5WmfymLEMchryWcG2pZgfCZDdHWGsRzewOoNENbiliZIBQPpoAKLSOkuKVurHYott7+NSJsOmgn4s+x2zYrV1Hg6owTJhAR8lD2l6e49TouK2VEZRiacbMwXVbGzHgYY13va82P5/7YifnxlwE3tIxEP1aJmujWRwmVMN8nKHh+s6x+RgNCAaY3aUywZ7DhISvtp/HEE1Dpz9lyJ5sJisJ5W8Fho53Etid8aF4oK0MTmeZ+AEPP8EONtEpPuPDlF/wu2lLHWd0ZWkWBNH7tiptAiOAKZUuNHJ7Vz863g06tA=----ATTACHMENT:----NzQ1NTgwNTUxNjY3NDE4OSAxNTgyMzMzMzQwMjIzMzM5IDY4ODE5ODQ5MDMzNDkzNzc=