public static function create($command, $app)
    {
        static $cache = [];
        $cacheKey = $command;

        if (isset($cache[$cacheKey]))  {
            $class = $cache[$cacheKey]['class'];
            $command = $cache[$cacheKey]['command'];
        } else {
            if (false === strpos($command, '.')) {
                // Not FQCN
                $class = __NAMESPACE__ . '\\' . String::convertToCamelCase($command);
            } else {
                // FQCN
                $class = explode('.', $command);
                $class = array_map(array('In2pire\\Component\\Utility\\Text', 'convertToCamelCase'), $class);
                $class = implode('\\', $class);
                $command = substr($command, strrpos($command, '.') + 1);
            }

            $cache[$cacheKey] = [
                'class' => $class,
                'command' => $command
            ];
        }

        if (!class_exists($class)) {
            throw new \RuntimeException('Unknow command ' . $cacheKey);
        }

        return new $class($app);
    }
public static function create($command, $app)
    {
        static $cache = [];
        $cacheKey = $command;

        if (isset($cache[$cacheKey]))  {
            $class = $cache[$cacheKey]['class'];
            $command = $cache[$cacheKey]['command'];
        } else {
            if (false === strpos($command, '.')) {
                // Not FQCN
                $class = __NAMESPACE__ . '\\' . String::convertToCamelCase($command);
            } else {
                // FQCN
                $class = explode('.', $command);
                $class = array_map(array('In2pire\\Component\\Utility\\Text', 'convertToCamelCase'), $class);
                $class = implode('\\', $class);
                $command = substr($command, strrpos($command, '.') + 1);
            }

            $cache[$cacheKey] = [
                'class' => $class,
                'command' => $command
            ];
        }

        if (!class_exists($class)) {
            throw new \RuntimeException('Unknow command ' . $cacheKey);
        }

        return new $class($app);
    }
public static function create ( $ command , $ app ) { static $ cache = [ ] ; $ cacheKey = $ command ; if ( isset ( $ cache [ $ cacheKey ] ) ) { $ class = $ cache [ $ cacheKey ] [ 'class' ] ; $ command = $ cache [ $ cacheKey ] [ 'command' ] ; } else { if ( false === strpos ( $ command , '.' ) ) { // Not FQCN $ class = __NAMESPACE__ . '\\' . String :: convertToCamelCase ( $ command ) ; } else { // FQCN $ class = explode ( '.' , $ command ) ; $ class = array_map ( array ( 'In2pire\\Component\\Utility\\Text' , 'convertToCamelCase' ) , $ class ) ; $ class = implode ( '\\' , $ class ) ; $ command = substr ( $ command , strrpos ( $ command , '.' ) + 1 ) ; } $ cache [ $ cacheKey ] = [ 'class' => $ class , 'command' => $ command ] ; } if ( ! class_exists ( $ class ) ) { throw new \ RuntimeException ( 'Unknow command ' . $ cacheKey ) ; } return new $ class ( $ app ) ; }
Create command from id.

@param string $command
Command ID.
@param In2pire\Cli\CliApplication $app
The running application

@return In2pire\Cli\Command\CliCommand
The created command.
Create command from id .