public static function executeCommand($commandName, array $commandParameters) {
        if (isset(self::$commands[$commandName])) {
            $commandAction = self::$commands[$commandName];
        }
        else {
            $commandsBaseNamespace = get_property("cli.commands_base_namespace");
            if (!empty($commandsBaseNamespace)) {
                $commandAction = $commandsBaseNamespace;
                $commandTokens = explode(".", $commandName);
                $commandTokensSize = sizeof($commandTokens);
                if ($commandTokensSize > 1) {
                    for ($i = 0; $i < $commandTokensSize - 1; $i++) {
                        $commandToken = $commandTokens[$i];
                        $commandAction .= '\\';
                        $commandAction .= str_replace(' ', '', ucwords(str_replace('_', ' ', $commandToken)));
                    }
                }
                $commandAction .= '\\';
                $commandAction .= str_replace(' ', '', ucwords(str_replace('_', ' ', $commandTokens[$commandTokensSize - 1])));
                $commandAction .= get_property("cli.commands_suffix", "Command");
            }
            else {
                throw new CommandNotFoundException("Command \"$commandName\" not found !!");
            }
        }

        $result = null;
        if (is_string($commandAction) && class_exists($commandAction) && is_subclass_of($commandAction, Command::class)) {
            if (!isset(self::$commandInstances[$commandAction])) {
                self::$commandInstances[$commandAction] = new $commandAction;
            }
            self::$commandInstances[$commandAction]->handle($commandParameters);
        }
        else  {
            try {
                get_app()->execute($commandAction, $commandParameters);
            }
            catch (ActionNotFoundException $ex) {
                throw new CommandNotFoundException("Command \"$commandName\" not found !!. Command class \"$commandAction\" not found !! ", 0, $ex);
            }
        }
        return $result;
    }
public static function executeCommand($commandName, array $commandParameters) {
        if (isset(self::$commands[$commandName])) {
            $commandAction = self::$commands[$commandName];
        }
        else {
            $commandsBaseNamespace = get_property("cli.commands_base_namespace");
            if (!empty($commandsBaseNamespace)) {
                $commandAction = $commandsBaseNamespace;
                $commandTokens = explode(".", $commandName);
                $commandTokensSize = sizeof($commandTokens);
                if ($commandTokensSize > 1) {
                    for ($i = 0; $i < $commandTokensSize - 1; $i++) {
                        $commandToken = $commandTokens[$i];
                        $commandAction .= '\\';
                        $commandAction .= str_replace(' ', '', ucwords(str_replace('_', ' ', $commandToken)));
                    }
                }
                $commandAction .= '\\';
                $commandAction .= str_replace(' ', '', ucwords(str_replace('_', ' ', $commandTokens[$commandTokensSize - 1])));
                $commandAction .= get_property("cli.commands_suffix", "Command");
            }
            else {
                throw new CommandNotFoundException("Command \"$commandName\" not found !!");
            }
        }

        $result = null;
        if (is_string($commandAction) && class_exists($commandAction) && is_subclass_of($commandAction, Command::class)) {
            if (!isset(self::$commandInstances[$commandAction])) {
                self::$commandInstances[$commandAction] = new $commandAction;
            }
            self::$commandInstances[$commandAction]->handle($commandParameters);
        }
        else  {
            try {
                get_app()->execute($commandAction, $commandParameters);
            }
            catch (ActionNotFoundException $ex) {
                throw new CommandNotFoundException("Command \"$commandName\" not found !!. Command class \"$commandAction\" not found !! ", 0, $ex);
            }
        }
        return $result;
    }
public static function executeCommand ( $ commandName , array $ commandParameters ) { if ( isset ( self :: $ commands [ $ commandName ] ) ) { $ commandAction = self :: $ commands [ $ commandName ] ; } else { $ commandsBaseNamespace = get_property ( "cli.commands_base_namespace" ) ; if ( ! empty ( $ commandsBaseNamespace ) ) { $ commandAction = $ commandsBaseNamespace ; $ commandTokens = explode ( "." , $ commandName ) ; $ commandTokensSize = sizeof ( $ commandTokens ) ; if ( $ commandTokensSize > 1 ) { for ( $ i = 0 ; $ i < $ commandTokensSize - 1 ; $ i ++ ) { $ commandToken = $ commandTokens [ $ i ] ; $ commandAction .= '\\' ; $ commandAction .= str_replace ( ' ' , '' , ucwords ( str_replace ( '_' , ' ' , $ commandToken ) ) ) ; } } $ commandAction .= '\\' ; $ commandAction .= str_replace ( ' ' , '' , ucwords ( str_replace ( '_' , ' ' , $ commandTokens [ $ commandTokensSize - 1 ] ) ) ) ; $ commandAction .= get_property ( "cli.commands_suffix" , "Command" ) ; } else { throw new CommandNotFoundException ( "Command \"$commandName\" not found !!" ) ; } } $ result = null ; if ( is_string ( $ commandAction ) && class_exists ( $ commandAction ) && is_subclass_of ( $ commandAction , Command :: class ) ) { if ( ! isset ( self :: $ commandInstances [ $ commandAction ] ) ) { self :: $ commandInstances [ $ commandAction ] = new $ commandAction ; } self :: $ commandInstances [ $ commandAction ] -> handle ( $ commandParameters ) ; } else { try { get_app ( ) -> execute ( $ commandAction , $ commandParameters ) ; } catch ( ActionNotFoundException $ ex ) { throw new CommandNotFoundException ( "Command \"$commandName\" not found !!. Command class \"$commandAction\" not found !! " , 0 , $ ex ) ; } } return $ result ; }
Execues a command
@param string $commandName Name of the command
@param array $commandParameters command parameters
@throws CommandNotFoundException
@return mixed
Execues a command