DataSift\Storyplayer\Cli\BuildTestEnvironment_Command::processCommand PHP Method

processCommand() public method

public processCommand ( Phix_Project\CliEngine $engine, array $params = [], DataSift\Storyplayer\Injectables | null $injectables = null ) : integer
$engine Phix_Project\CliEngine
$params array
$injectables DataSift\Storyplayer\Injectables | null
return integer
    public function processCommand(CliEngine $engine, $params = array(), $injectables = null)
    {
        // we need to wrap our code to catch old-style PHP errors
        $legacyHandler = new Legacy_ErrorHandler();
        // run our code
        try {
            $returnCode = $legacyHandler->run([$this, 'processInsideLegacyHandler'], [$engine, $params, $injectables]);
            return $returnCode;
        } catch (Exception $e) {
            $injectables->output->logCliError($e->getMessage());
            $engine->options->dev = true;
            if (isset($engine->options->dev) && $engine->options->dev) {
                $injectables->output->logCliError("Stack trace is:\n\n" . $e->getTraceAsString());
            }
            // stop the browser if available
            if (isset($this->st)) {
                $this->st->stopDevice();
            }
            // tell the calling process that things did not end well
            exit(1);
        }
    }