Redaxscript\Console\Command\Config::run PHP Method

run() public method

run the command
Since: 3.0.0
public run ( string $mode = null ) : string
$mode string name of the mode
return string
    public function run($mode = null)
    {
        $parser = new Parser($this->_request);
        $parser->init($mode);
        /* run command */
        $argumentKey = $parser->getArgument(1);
        if ($argumentKey === 'list') {
            return $this->_list();
        }
        if ($argumentKey === 'set') {
            return $this->_set($parser->getOption());
        }
        if ($argumentKey === 'parse') {
            return $this->_parse($parser->getOption());
        }
        if ($argumentKey === 'lock') {
            return $this->_lock($parser->getOption());
        }
        return $this->getHelp();
    }

Usage Example

Example #1
0
 /**
  * testLock
  *
  * @since 3.0.0
  */
 public function testLock()
 {
     /* setup */
     $this->_config->init(Stream::url('root/config.php'));
     $this->_request->setServer('argv', ['console.php', 'config', 'lock']);
     $configCommand = new Command\Config($this->_registry, $this->_request, $this->_config);
     /* actual */
     $actual = $configCommand->run('cli');
     /* compare */
     $this->assertTrue($actual);
 }