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


PHP ArrayInput::hasParameterOption方法代码示例

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


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

示例1: testHasParameterOption

 public function testHasParameterOption()
 {
     $input = new ArrayInput(array('name' => 'Fabien', '--foo' => 'bar'));
     $this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if an option is present in the passed parameters');
     $this->assertFalse($input->hasParameterOption('--bar'), '->hasParameterOption() returns false if an option is not present in the passed parameters');
     $input = new ArrayInput(array('--foo'));
     $this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if an option is present in the passed parameters');
     $input = new ArrayInput(array('--foo', '--', '--bar'));
     $this->assertTrue($input->hasParameterOption('--bar'), '->hasParameterOption() returns true if an option is present in the passed parameters');
     $this->assertFalse($input->hasParameterOption('--bar', true), '->hasParameterOption() returns false if an option is present in the passed parameters after an end of options signal');
 }
开发者ID:saj696,项目名称:pipe,代码行数:11,代码来源:ArrayInputTest.php

示例2: doRun

 /**
  * Runs the current application.
  *
  * @param InputInterface  $input  An Input instance
  * @param OutputInterface $output An Output instance
  *
  * @return integer 0 if everything went fine, or an error code
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     $output->writeLn($this->getHeader());
     $name = $this->getCommandName($input);
     if (true === $input->hasParameterOption(array('--shell', '-s'))) {
         $shell = new Shell($this);
         $shell->run();
         return 0;
     }
     if (true === $input->hasParameterOption(array('--ansi'))) {
         $output->setDecorated(true);
     } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
         $output->setDecorated(false);
     }
     if (true === $input->hasParameterOption(array('--help', '-h'))) {
         if (!$name) {
             $name = 'help';
             $input = new ArrayInput(array('command' => 'help'));
         } else {
             $this->wantHelps = true;
         }
     }
     if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
         $input->setInteractive(false);
     }
     if (function_exists('posix_isatty') && $this->getHelperSet()->has('dialog')) {
         $inputStream = $this->getHelperSet()->get('dialog')->getInputStream();
         if (!posix_isatty($inputStream)) {
             $input->setInteractive(false);
         }
     }
     if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
         $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
     } elseif (true === $input->hasParameterOption(array('--verbose', '-v'))) {
         $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
     }
     if (true === $input->hasParameterOption(array('--version', '-V'))) {
         $output->writeln($this->getLongVersion());
         return 0;
     }
     if (!$name) {
         $name = 'list';
         $input = new ArrayInput(array('command' => 'list'));
     }
     // the command name MUST be the first element of the input
     $command = $this->find($name);
     $this->runningCommand = $command;
     $statusCode = $command->run($input, $output);
     $this->runningCommand = null;
     # write Footer
     $output->writeLn($this->getFooter());
     return is_numeric($statusCode) ? $statusCode : 0;
 }
开发者ID:icomefromthenet,项目名称:faker,代码行数:61,代码来源:Application.php

示例3: doRun

 /**
  * Runs the current application.
  *
  * @param InputInterface  $input  An Input instance
  * @param OutputInterface $output An Output instance
  *
  * @return integer 0 if everything went fine, or an error code
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     $name = $this->getCommandName($input);
     if (true === $input->hasParameterOption(array('--ansi'))) {
         $output->setDecorated(true);
     } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
         $output->setDecorated(false);
     }
     if (true === $input->hasParameterOption(array('--help', '-h'))) {
         if (!$name) {
             $name = 'help';
             $input = new ArrayInput(array('command' => 'help'));
         } else {
             $this->wantHelps = true;
         }
     }
     if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
         $input->setInteractive(false);
     }
     if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
         $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
     } elseif (true === $input->hasParameterOption(array('--verbose', '-v'))) {
         $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
     }
     if (true === $input->hasParameterOption(array('--version', '-V'))) {
         $output->writeln($this->getLongVersion());
         return 0;
     }
     if (!$name) {
         $name = 'list';
         $input = new ArrayInput(array('command' => 'list'));
     }
     // the command name MUST be the first element of the input
     $command = $this->find($name);
     $this->runningCommand = $command;
     $statusCode = $command->run($input, $output);
     $this->runningCommand = null;
     return is_numeric($statusCode) ? $statusCode : 0;
 }
开发者ID:pollux1er,项目名称:dlawebdev2,代码行数:47,代码来源:Application.php


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