Redaxscript\Console\Console::init PHP Method

init() public method

init the class
Since: 3.0.0
public init ( string $mode = null ) : mixed
$mode string name of the mode
return mixed
    public function init($mode = null)
    {
        $parser = new Parser($this->_request);
        $parser->init($mode);
        /* run command */
        $commandKey = $parser->getArgument(0);
        if (array_key_exists($commandKey, $this->_namespaceArray)) {
            $commandClass = $this->_namespaceArray[$commandKey];
            if (class_exists($commandClass)) {
                $command = new $commandClass($this->_registry, $this->_request, $this->_config);
                return $command->run($mode);
            }
        }
        return false;
    }

Usage Example

Esempio n. 1
0
 /**
  * console line
  *
  * @since 3.0.0
  *
  * @return string
  */
 public static function consoleLine()
 {
     $console = new Console\Console(Registry::getInstance(), Request::getInstance(), Config::getInstance());
     $output = $console->init('template');
     if (is_string($output)) {
         return htmlentities($output);
     }
 }
All Usage Examples Of Redaxscript\Console\Console::init
Console