当前位置: 首页>>代码示例>>PHP>>正文


PHP Shell::run方法代码示例

本文整理汇总了PHP中Psy\Shell::run方法的典型用法代码示例。如果您正苦于以下问题:PHP Shell::run方法的具体用法?PHP Shell::run怎么用?PHP Shell::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Psy\Shell的用法示例。


在下文中一共展示了Shell::run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $config = $this->getPsyConfig();
     $psy_config = new Configuration($config);
     $psy_shell = new Shell($psy_config);
     $psy_shell->run();
 }
开发者ID:anna-framework,项目名称:anna,代码行数:7,代码来源:DeskCommand.php

示例2: execute

    /**
     * @param InputInterface  $input
     * @param OutputInterface $output
     *
     * @return int|void
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $initialized = false;
        try {
            $this->detectMagento($output);
            $initialized = $this->initMagento();
        } catch (Exception $e) {
            // do nothing
        }
        $parser = new Parser(new Lexer());
        $cleaner = new CodeCleaner($parser);
        $consoleOutput = new ShellOutput();
        $config = new Configuration();
        $config->setCodeCleaner($cleaner);
        $shell = new Shell($config);
        $shell->setScopeVariables(['di' => $this->getObjectManager()]);
        if ($initialized) {
            $ok = Charset::convertInteger(Charset::UNICODE_CHECKMARK_CHAR);
            $edition = $this->productMeta->getEdition();
            $magentoVersion = $this->productMeta->getVersion();
            $consoleOutput->writeln('<fg=black;bg=green>Magento ' . $magentoVersion . ' ' . $edition . ' initialized.</fg=black;bg=green> ' . $ok);
        } else {
            $consoleOutput->writeln('<fg=black;bg=yellow>Magento is not initialized.</fg=black;bg=yellow>');
        }
        $help = <<<'help'
At the prompt, type <comment>help</comment> for some help.

To exit the shell, type <comment>^D</comment>.
help;
        $consoleOutput->writeln($help);
        $shell->run($input, $consoleOutput);
    }
开发者ID:ktomk,项目名称:n98-magerun2,代码行数:38,代码来源:ConsoleCommand.php

示例3: main

 /**
  * Start the shell and interactive console.
  *
  * @return int|void
  */
 public function main()
 {
     if (!class_exists('Psy\\Shell')) {
         $this->err('<error>Unable to load Psy\\Shell.</error>');
         $this->err('');
         $this->err('Make sure you have installed psysh as a dependency,');
         $this->err('and that Psy\\Shell is registered in your autoloader.');
         $this->err('');
         $this->err('If you are using composer run');
         $this->err('');
         $this->err('<info>$ php composer.phar require --dev psy/psysh</info>');
         $this->err('');
         return 1;
     }
     $this->out("You can exit with <info>`CTRL-C`</info> or <info>`exit`</info>");
     $this->out('');
     Log::drop('debug');
     Log::drop('error');
     $this->_io->setLoggers(false);
     restore_error_handler();
     restore_exception_handler();
     $psy = new PsyShell();
     $psy->run();
     return 0;
 }
开发者ID:bostontrader,项目名称:acctwerx,代码行数:30,代码来源:ConsoleShell.php

示例4: main

 public function main(array $argv)
 {
     $parser = $this->getParser();
     $parser->process($argv);
     if ($parser->optionIsSet("help")) {
         $this->out($parser->helpText());
         return 0;
     }
     if (!class_exists('Psy\\Shell')) {
         $this->err('<error>Unable to load Psy\\Shell.</error>');
         $this->err('');
         $this->err('Make sure you have installed psysh as a dependency,');
         $this->err('and that Psy\\Shell is registered in your autoloader.');
         $this->err('');
         $this->err('If you are using composer run');
         $this->err('');
         $this->err('<info>$ php composer.phar require --dev psy/psysh</info>');
         $this->err('');
         return 1;
     }
     $this->out("You can exit with <info>`CTRL-C`</info> or <info>`exit`</info>");
     $this->out('');
     $psy = new Shell();
     $psy->run();
     return 0;
 }
开发者ID:coretyson,项目名称:coretyson,代码行数:26,代码来源:InterpreterShell.php

示例5: handle

 /**
  * Handle the command.
  *
  * @return void
  */
 public function handle()
 {
     $this->getApplication()->setCatchExceptions(false);
     $shell = new Shell();
     $shell->setIncludes($this->argument('include'));
     $shell->run();
 }
开发者ID:oxyzero,项目名称:tempest,代码行数:12,代码来源:TinkerCommand.php

示例6: start

 /**
  * Start
  *
  * @return void
  */
 protected function start()
 {
     $configFile = $this->getOption("psy-config");
     $configuration = is_null($configFile) ? null : new Configuration(compact("configFile"));
     $shell = new Shell($configuration);
     $shell->run();
 }
开发者ID:Hiroto-K,项目名称:Tw-Cron,代码行数:12,代码来源:ConsoleCommand.php

示例7: actionIndex

 /**
  * Runs interactive shell
  */
 public function actionIndex()
 {
     $config = new Configuration();
     $config->getPresenter()->addCasters($this->getCasters());
     $shell = new Shell($config);
     $shell->setIncludes($this->include);
     $shell->run();
 }
开发者ID:yiisoft,项目名称:yii2-shell,代码行数:11,代码来源:ShellController.php

示例8: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->blink->bootstrap();
     $config = new Configuration();
     $config->getPresenter()->addCasters($this->casters);
     $shell = new Shell($config);
     return $shell->run();
 }
开发者ID:bixuehujin,项目名称:blink,代码行数:8,代码来源:ShellCommand.php

示例9: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->startup($input, $output);
     $output->writeln('Press <info>CTRL + C</info> or type <info>exit</info> to quit');
     $this->nl();
     $psy = new PsyShell();
     $psy->run();
 }
开发者ID:francoisfaubert,项目名称:strata,代码行数:11,代码来源:ConsoleCommand.php

示例10: fire

 /**
  * @return void
  */
 public function fire()
 {
     $this->getApplication()->setCatchExceptions(false);
     $config = new Configuration();
     $config->getPresenter()->addCasters($this->getCasters());
     $shell = new Shell($config);
     $shell->addCommands($this->getCommands());
     $shell->setIncludes($this->argument('include'));
     $shell->run();
 }
开发者ID:notadd,项目名称:framework,代码行数:13,代码来源:TinkerCommand.php

示例11: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $shell = new Shell($this->getConfig());
     $shell->run();
 }
开发者ID:ahmadsherif,项目名称:laravel-psysh,代码行数:10,代码来源:PsySHCommand.php

示例12: fire

 /**
  * {@inheritdoc}
  */
 protected function fire()
 {
     $shell = new Shell();
     $shell->run();
 }
开发者ID:mattstauffer,项目名称:craft-cli,代码行数:8,代码来源:ConsoleCommand.php

示例13: bin

    /**
     * `psysh` command line executable.
     *
     * @return Closure
     */
    function bin()
    {
        return function () {
            $usageException = null;
            $input = new ArgvInput();
            try {
                $input->bind(new InputDefinition(array(new InputOption('help', 'h', InputOption::VALUE_NONE), new InputOption('config', 'c', InputOption::VALUE_REQUIRED), new InputOption('version', 'v', InputOption::VALUE_NONE), new InputOption('cwd', null, InputOption::VALUE_REQUIRED), new InputArgument('include', InputArgument::IS_ARRAY))));
            } catch (\RuntimeException $e) {
                $usageException = $e;
            }
            $config = array();
            // Handle --config
            if ($configFile = $input->getOption('config')) {
                $config['configFile'] = $configFile;
            }
            $shell = new Shell(new Configuration($config));
            // Handle --help
            if ($usageException !== null || $input->getOption('help')) {
                if ($usageException !== null) {
                    echo $usageException->getMessage() . PHP_EOL . PHP_EOL;
                }
                $version = $shell->getVersion();
                $name = basename(reset($_SERVER['argv']));
                echo <<<EOL
{$version}

Usage:
  {$name} [--version] [--help] [files...]

Options:
  --help     -h Display this help message.
  --config   -c Use an alternate PsySH config file location.
  --cwd         Use an alternate working directory.
  --version  -v Display the PsySH version.

EOL;
                exit($usageException === null ? 0 : 1);
            }
            // Handle --version
            if ($input->getOption('version')) {
                echo $shell->getVersion() . PHP_EOL;
                exit(0);
            }
            // Pass additional arguments to Shell as 'includes'
            $shell->setIncludes($input->getArgument('include'));
            try {
                // And go!
                $shell->run();
            } catch (Exception $e) {
                echo $e->getMessage() . PHP_EOL;
                // TODO: this triggers the "exited unexpectedly" logic in the
                // ForkingLoop, so we can't exit(1) after starting the shell...
                // fix this :)
                // exit(1);
            }
        };
    }
开发者ID:saj696,项目名称:pipe,代码行数:62,代码来源:functions.php

示例14: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $this->getApplication()->setCatchExceptions(false);
     $shell = new Shell();
     $shell->run();
 }
开发者ID:fparralejo,项目名称:btrabajo,代码行数:11,代码来源:TinkerCommand.php

示例15: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $shell = new Shell();
     $shell->setScopeVariables(['app' => $this->container, 'config' => $this->container->get(ConfigurationInterface::class)]);
     $shell->run();
 }
开发者ID:hannesvdvreken,项目名称:glue,代码行数:9,代码来源:TinkerCommand.php


注:本文中的Psy\Shell::run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。