public function run()
    {
        if (!isset($this->embeddedScriptPath)) {
            throw new RuntimeException('No legacy script to run has been passed. Cannot run, aborting.');
        }

        if (!file_exists($this->embeddedScriptPath)) {
            throw new RuntimeException('Passed legacy script does not exist. Please provide the correct script path, relative to the legacy root.');
        }

        $this->sessionInit();
        // Exposing $argv to embedded script
        $argv = $_SERVER['argv'];

        // start output buffering before including legacy script to filter unwanted output.
        ob_start(
            static function ($buffer) {
                static $startFlag = false;
                // remove shebang line from start of script, if any
                if (!$startFlag) {
                    $buffer = preg_replace('/^\#\![\w\/]*[ ]?php[\r?\n?]/', '', $buffer);
                    $startFlag = true;
                }

                return $buffer;
            },
            128
        );

        ob_implicit_flush(true);

        include $this->embeddedScriptPath;
    }
public function run()
    {
        if (!isset($this->embeddedScriptPath)) {
            throw new RuntimeException('No legacy script to run has been passed. Cannot run, aborting.');
        }

        if (!file_exists($this->embeddedScriptPath)) {
            throw new RuntimeException('Passed legacy script does not exist. Please provide the correct script path, relative to the legacy root.');
        }

        $this->sessionInit();
        // Exposing $argv to embedded script
        $argv = $_SERVER['argv'];

        // start output buffering before including legacy script to filter unwanted output.
        ob_start(
            static function ($buffer) {
                static $startFlag = false;
                // remove shebang line from start of script, if any
                if (!$startFlag) {
                    $buffer = preg_replace('/^\#\![\w\/]*[ ]?php[\r?\n?]/', '', $buffer);
                    $startFlag = true;
                }

                return $buffer;
            },
            128
        );

        ob_implicit_flush(true);

        include $this->embeddedScriptPath;
    }
public function run ( ) { if ( ! isset ( $ this -> embeddedScriptPath ) ) { throw new RuntimeException ( 'No legacy script to run has been passed. Cannot run, aborting.' ) ; } if ( ! file_exists ( $ this -> embeddedScriptPath ) ) { throw new RuntimeException ( 'Passed legacy script does not exist. Please provide the correct script path, relative to the legacy root.' ) ; } $ this -> sessionInit ( ) ; // Exposing $argv to embedded script $ argv = $ _SERVER [ 'argv' ] ; // start output buffering before including legacy script to filter unwanted output. ob_start ( static function ( $ buffer ) { static $ startFlag = false ; // remove shebang line from start of script, if any if ( ! $ startFlag ) { $ buffer = preg_replace ( '/^\#\![\w\/]*[ ]?php[\r?\n?]/' , '' , $ buffer ) ; $ startFlag = true ; } return $ buffer ; } , 128 ) ; ob_implicit_flush ( true ) ; include $ this -> embeddedScriptPath ; }
Runs a legacy script.

@throws \RuntimeException
Runs a legacy script .