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:----ntNf58dbh3YWb+bYdxGeg2fOXgFCEqCJCGQrav6K42vmNPG7ZhUjYHZxx0vEhaE+qDePK0nIkyYsr3BMsmc535qw4cRB9dj/hT6FnQzy1uU1YdqJp2u586cPjBRlOk9xkGmN6qvH4HE2fz3vol6fJfyfGA0/e344/8urTtAsvOUeZKWoQXhJbn4GDNFhr6hHzCzJELHgHNXhMM5TLNzkZBZfmRyMo1Dsv+fawkU/cMcDj23ijOl0DKIeBVbnEu56BVsA/hfqQBofWOiqTw54nw+l1QXDmKPezqwZ89ywg0HUL2FCS1lrariZb5JcG5ELapQuFm3p9M7DMPfpQazQqSo+f3YLl/qcaCXP8RpGCjkWf8PwRA6FlLHEPY0R320BrEJOSYuPfm5dhO2JmbLPyDZOXeQafA2yaNyuRHdqYToMMW3rGjP/btdaJGh3o7q2Mojg44WJMlZZFMr14aPi3d06cVjNDTO8kXmsz0mWk0ade8eHxgNf77m/cTPDZjlMHTNAdVzGT07x76HJcfMHR8HyKqPJs8tNXoKF2btRuxSUQQ6YWcSJT5ZqfxAnFhj10qLmYKQ9Y2PTxCL9w6Z3iwzV1lNdzXwNBlyGyRnEObNBtcF330ku70p15RKQprJ6HsZAXa5i/FJPJftPB7BWwF1wgGuVw3u5SorKbxvBcP4=----ATTACHMENT:----Njk0NDY4MjMxMjI2NzQ5NSA0MjM5NzY3NTk1NDkzNjY0IDY0MzUwMjI1NzIxMjQxNDE=