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


PHP Command::run方法代码示例

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


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

示例1: run

 /**
  * Override run method to internationalize error message.
  *
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @return int Return code
  */
 public function run(InputInterface $input, OutputInterface $output)
 {
     // Set extra colors
     // The most problem is $output->getFormatter() don't work.
     // So create new formatter to add extra color.
     $formatter = new OutputFormatter($output->isDecorated());
     $formatter->setStyle('red', new OutputFormatterStyle('red', 'black'));
     $formatter->setStyle('green', new OutputFormatterStyle('green', 'black'));
     $formatter->setStyle('yellow', new OutputFormatterStyle('yellow', 'black'));
     $formatter->setStyle('blue', new OutputFormatterStyle('blue', 'black'));
     $formatter->setStyle('magenta', new OutputFormatterStyle('magenta', 'black'));
     $formatter->setStyle('yellow-blue', new OutputFormatterStyle('yellow', 'blue'));
     $output->setFormatter($formatter);
     \App::setLocale(\Config::get('syncle::MessageLang'));
     try {
         $result = parent::run($input, $output);
     } catch (\RuntimeException $e) {
         // All error messages were hard coded in
         // Symfony/Component/Console/Input/Input.php
         if ($e->getMessage() == 'Not enough arguments.') {
             $this->error(\Lang::get('syncle::BaseCommand.ArgumentNotEnough'));
         } elseif ($e->getMessage() == 'Too many arguments.') {
             $this->error(\Lang::get('syncle::BaseCommand.TooManyArgument'));
         } elseif (preg_match('/The "(.+)" option does not exist./', $e->getMessage(), $matches)) {
             $this->error(\Lang::get('syncle::BaseCommand.OptionNotExist', array('option' => $matches[1])));
         } else {
             $this->error($e->getMessage());
         }
         $result = 1;
     }
     return $result;
 }
开发者ID:hirokws,项目名称:syncle,代码行数:39,代码来源:BaseCommand.php

示例2: run

 public function run(InputInterface $input, OutputInterface $output)
 {
     // Set extra colors.
     // The most problem is $output->getFormatter() don't work...
     // So create new formatter to add extra color.
     $formatter = new OutputFormatter($output->isDecorated());
     $formatter->setStyle('red', new OutputFormatterStyle('red', 'black'));
     $formatter->setStyle('green', new OutputFormatterStyle('green', 'black'));
     $formatter->setStyle('yellow', new OutputFormatterStyle('yellow', 'black'));
     $formatter->setStyle('blue', new OutputFormatterStyle('blue', 'black'));
     $formatter->setStyle('magenta', new OutputFormatterStyle('magenta', 'black'));
     $formatter->setStyle('yellow-blue', new OutputFormatterStyle('yellow', 'blue'));
     $output->setFormatter($formatter);
     return parent::run($input, $output);
 }
开发者ID:paramonovav,项目名称:laravel-optimize-images,代码行数:15,代码来源:BaseCommand.php

示例3: run

 /**
  * Symfonyコマンドコンポーネントにハードコードされている
  * エラーメッセージを日本語に変換する.
  *
  * @param \Symfony\Component\Console\Input\InputInterface   $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @return int Return code
  */
 public function run(InputInterface $input, OutputInterface $output)
 {
     try {
         $result = parent::run($input, $output);
     } catch (\RuntimeException $e) {
         if ($e->getMessage() == 'Not enough arguments.') {
             throw new \RuntimeException(__('引数が足りません。'), $e->getCode(), $e->getPrevious());
         } elseif ($e->getMessage() == 'Too many arguments.') {
             throw new \RuntimeException(__('引数が多すぎます。'), $e->getCode(), $e->getPrevious());
         } elseif (preg_match('/The "(.+)" option does not exist./', $e->getMessage(), $matches)) {
             throw new \RuntimeException(__($matches[1] . 'オプションは存在していません。'), $e->getCode(), $e->getPrevious());
         } else {
             throw new \RuntimeException($e->getMessage(), $e->getCode(), $e->getPrevious());
         }
     }
     return $result;
 }
开发者ID:HiroKws,项目名称:zakkuto-laravel-hub-site,代码行数:26,代码来源:BaseCommand.php

示例4: run

 /**
  * Override run method to internationalize error message.
  *
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @return int Return code
  */
 public function run(InputInterface $input, OutputInterface $output)
 {
     try {
         $result = parent::run($input, $output);
     } catch (\RuntimeException $e) {
         // All error messages were hard coded in
         // Symfony/Component/Console/Input/Input.php
         if ($e->getMessage() == 'Not enough arguments.') {
             $this->error(\Lang::get('StriveJobs::BaseCommand.ArgumentNotEnough'));
         } elseif ($e->getMessage() == 'Too many arguments.') {
             $this->error(\Lang::get('StriveJobs::BaseCommand.TooManyArgument'));
         } elseif (preg_match('/The "(.+)" option does not exist./', $e->getMessage(), $matches)) {
             $this->error(\Lang::get('StriveJobs::BaseCommand.OptionNotExist', array('option' => $matches[1])));
         } else {
             $this->error($e->getMessage());
         }
         $result = 1;
         // As error status code
     }
     return $result;
 }
开发者ID:hirokws,项目名称:strivejobs,代码行数:28,代码来源:BaseCommand.php

示例5: runCommand

 protected function runCommand(Command $command, array $input, OutputInterface $output)
 {
     $command->setLaravel($this->app);
     return $command->run(new ArrayInput($input), $output);
 }
开发者ID:gummibeer,项目名称:backuplay,代码行数:5,代码来源:TestCase.php

示例6: run

 /**
  * @param \Symfony\Component\Console\Input\InputInterface   $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @return int
  */
 public function run(InputInterface $input, OutputInterface $output)
 {
     app(ConsoleOutput::class)->setOutput($this);
     return parent::run($input, $output);
 }
开发者ID:ericmakesstuff,项目名称:laravel-server-monitor,代码行数:11,代码来源:BaseCommand.php

示例7: runCommand

 /**
  * Run the command.
  * @param \Illuminate\Console\Command $command
  * @param array $input
  * @return int
  */
 protected function runCommand($command, $input = [])
 {
     return $command->run(new ArrayInput($input), new NullOutput());
 }
开发者ID:micheleangioni,项目名称:laravel-js-lang-converter,代码行数:10,代码来源:LangJsCommandTest.php

示例8: run

 /**
  * run.
  *
  * @param \Symfony\Component\Console\Input\InputInterface   $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @return \Symfony\Component\Console\Input\StringInput
  */
 public function run(InputInterface $input, OutputInterface $output)
 {
     $command = (string) $input;
     $command = strtr($command, [' -name' => ' -N', ' -type' => ' -T', ' -maxdepth' => ' -M', ' -delete' => ' -d true']);
     return parent::run(new StringInput($command), $output);
 }
开发者ID:recca0120,项目名称:laravel-terminal,代码行数:14,代码来源:Find.php

示例9: invokeCommand

 /**
  * @param \Illuminate\Console\Command $mockedCommandObject
  * @param array $arguments
  * @return int
  */
 public function invokeCommand(Command $mockedCommandObject, $arguments = [])
 {
     $mockedCommandObject->setLaravel(app());
     return $mockedCommandObject->run(new ArrayInput($arguments), $this->getCommandOutput());
 }
开发者ID:skimia,项目名称:foundation,代码行数:10,代码来源:CommandTrait.php

示例10: run

 public function run(InputInterface $input, OutputInterface $output)
 {
     $options = $input->__toString();
     $arr = explode(' ', $options);
     array_shift($arr);
     foreach ($arr as $i => &$option) {
         $option = trim($option, "'");
         if (strpos($option, '-') === 0) {
             $option = '{' . $option . '?}';
         } else {
             $option = '{k' . $i . '}';
         }
     }
     $this->signature = implode(' ', $arr);
     $this->configureUsingFluentDefinition();
     $this->setDescription($this->description);
     return parent::run($input, $output);
 }
开发者ID:garveen,项目名称:imagist-old,代码行数:18,代码来源:Composer.php


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