Phrozn\Runner\CommandLine::run PHP Method

run() public method

Process the request
public run ( array $params = null ) : void
$params array Runner options
return void
    public function run($params = null)
    {
        $this->parser = new Parser($this->paths);
        try {
            $argc = $params === null ? null : count($params);
            $this->result = $this->parser->parse($argc, $params);
        } catch (\Exception $e) {
            $this->parser->displayError($e->getMessage());
        }
        $this->parse();
    }

Usage Example

Example #1
0
#!/usr/bin/env php
<?php
namespace Phrozn;
use Phrozn\Runner\CommandLine as Runner,
    Phrozn\Autoloader as Loader;

if (strpos('@PHP-BIN@', '@PHP-BIN') === 0) { // stand-alone version is running
    $base = dirname(__FILE__) . '/../';
    set_include_path($base . PATH_SEPARATOR . get_include_path());
}

require_once 'Phrozn/Autoloader.php';
$loader = Loader::getInstance();
$runner = new Runner($loader);
$runner->run();

unset($runner, $loader);