src/Mmi/Console/Application.php
protected function getApplicationCommands()
    {
        $commands = [];
        foreach (StructureParser::getModules() as $module) {
            //namespace modułu
            $moduleNamespace = substr($module, strrpos($module, DIRECTORY_SEPARATOR) + 1, strlen($module));
            //iteracja po komendach konsolowych
            foreach (glob($module . '/Console/*Command.php') as $command) {
                $className = basename($command, '.php');
                $class = '\\' . $moduleNamespace . '\\Console\\' . $className;

                //reflection do sprawdzenia pochodzenia
                $r = new \ReflectionClass($class);
                if ($r->isSubclassOf('Mmi\\Console\\CommandAbstract')
                    && !$r->isAbstract()
                    && !$r->getConstructor()->getNumberOfRequiredParameters()
                ) {
                    $commands[] = $r->newInstance();
                }
            }
        }
        return $commands;
    }
protected function getApplicationCommands()
    {
        $commands = [];
        foreach (StructureParser::getModules() as $module) {
            //namespace modułu
            $moduleNamespace = substr($module, strrpos($module, DIRECTORY_SEPARATOR) + 1, strlen($module));
            //iteracja po komendach konsolowych
            foreach (glob($module . '/Console/*Command.php') as $command) {
                $className = basename($command, '.php');
                $class = '\\' . $moduleNamespace . '\\Console\\' . $className;

                //reflection do sprawdzenia pochodzenia
                $r = new \ReflectionClass($class);
                if ($r->isSubclassOf('Mmi\\Console\\CommandAbstract')
                    && !$r->isAbstract()
                    && !$r->getConstructor()->getNumberOfRequiredParameters()
                ) {
                    $commands[] = $r->newInstance();
                }
            }
        }
        return $commands;
    }
protected function getApplicationCommands ( ) { $ commands = [ ] ; foreach ( StructureParser :: getModules ( ) as $ module ) { //namespace modułu $ moduleNamespace = substr ( $ module , strrpos ( $ module , DIRECTORY_SEPARATOR ) + 1 , strlen ( $ module ) ) ; //iteracja po komendach konsolowych foreach ( glob ( $ module . '/Console/*Command.php' ) as $ command ) { $ className = basename ( $ command , '.php' ) ; $ class = '\\' . $ moduleNamespace . '\\Console\\' . $ className ; //reflection do sprawdzenia pochodzenia $ r = new \ ReflectionClass ( $ class ) ; if ( $ r -> isSubclassOf ( 'Mmi\\Console\\CommandAbstract' ) && ! $ r -> isAbstract ( ) && ! $ r -> getConstructor ( ) -> getNumberOfRequiredParameters ( ) ) { $ commands [ ] = $ r -> newInstance ( ) ; } } } return $ commands ; }
Pobieranie komend z aplikacji
Pobieranie komend z aplikacji