DataSift\Storyplayer\Cli\Script_Command::processInsideLegacyHandler PHP Метод

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

public processInsideLegacyHandler ( Phix_Project\CliEngine $engine, $params = [], $injectables = null )
$engine Phix_Project\CliEngine
    public function processInsideLegacyHandler(CliEngine $engine, $params = array(), $injectables = null)
    {
        // make sure we're using the ScriptConsole by default
        $injectables->output->usePluginInSlot(new ScriptConsole(), 'console');
        // process the common functionality
        $this->initFeaturesBeforeModulesAvailable($engine);
        // now it is safe to create our shorthand
        $runtimeConfig = $injectables->getRuntimeConfig();
        $runtimeConfigManager = $injectables->getRuntimeConfigManager();
        $output = $injectables->output;
        // save the output for use in other methods
        $this->output = $output;
        // at this point, all of the services / data held in $injectables
        // has been initialised and is ready for use
        // create a new StoryTeller object
        $st = new StoryTeller($injectables);
        // remember our $st object, as we'll need it for our
        // shutdown function
        $this->st = $st;
        // now that we have $st, we can initialise any feature that
        // wants to use our modules
        $this->initFeaturesAfterModulesAvailable($st, $engine, $injectables);
        // install signal handling, now that $this->st is defined
        //
        // we wouldn't want signal handling called out of order :)
        $this->initSignalHandling($injectables);
        // build our list of stories to run
        $this->initScriptList($engine, $injectables, $params);
        // and we're ready to tell the world that we're here
        $output->startStoryplayer($engine->getAppVersion(), $engine->getAppUrl(), $engine->getAppCopyright(), $engine->getAppLicense());
        // $this->scriptList contains one or more things to run
        //
        // let's play each of them in order
        foreach ($this->scriptList as $player) {
            // play the story(ies)
            $player->play($st, $injectables);
        }
        // write out any changed runtime config to disk
        $runtimeConfigManager->saveRuntimeConfig($runtimeConfig, $output);
        // tell the output plugins that we're all done
        $output->endStoryplayer(0);
        // all done
        return 0;
    }