Redaxscript\Console\Command\Cache::run PHP Метод

run() публичный Метод

run the command
С версии: 3.0.0
public run ( string $mode = null ) : string
$mode string name of the mode
Результат string
    public function run($mode = null)
    {
        $parser = new Parser($this->_request);
        $parser->init($mode);
        /* run command */
        $argumentKey = $parser->getArgument(1);
        if ($argumentKey === 'clear') {
            return $this->_clear($parser->getOption());
        }
        if ($argumentKey === 'clear-invalid') {
            return $this->_clearInvalid($parser->getOption());
        }
        return $this->getHelp();
    }

Usage Example

Пример #1
0
 /**
  * testClearInvalid
  *
  * @since 3.0.0
  */
 public function testClearInvalid()
 {
     /* setup */
     $this->_request->setServer('argv', ['console.php', 'cache', 'clear-invalid', '--directory', 'cache/page', '--lifetime', '3600']);
     $cacheCommand = new Command\Cache($this->_registry, $this->_request, $this->_config);
     /* actual */
     $actual = $cacheCommand->run('cli');
     /* compare */
     $this->assertEquals('cache/page', $actual->getDirectory());
 }