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


PHP InputInterface::getParameterOption方法代码示例

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


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

示例1: processOptions

 protected function processOptions()
 {
     if (!isset($this->options['environment'])) {
         $this->options['environment'] = getenv('SYMFONY_ENV') ?: 'prod';
     }
     if (null !== $this->input) {
         $this->options['environment'] = $this->input->getParameterOption(['--env', '-e'], $this->options['environment']);
     }
     if (!isset($this->options['localhost_only']) || $this->options['environment'] == 'prod') {
         $this->options['localhost_only'] = false;
     }
     if (getenv('SYMFONY_DEBUG') === '0' || null !== $this->input && $this->input->hasParameterOption(['--no-debug', ''])) {
         $this->options['debug'] = false;
     }
     if (!isset($this->options['debug'])) {
         $this->options['debug'] = $this->options['environment'] == 'dev';
     }
     $this->options['umask_fix'] = isset($this->options['umask_fix']) ? (bool) $this->options['umask_fix'] : false;
     if (empty($this->options['apc_cache_id']) || $this->options['environment'] != 'prod') {
         $this->options['apc_cache_id'] = false;
     }
     if (!isset($this->options['http_cache']) || $this->options['environment'] != 'prod') {
         $this->options['http_cache'] = false;
     }
 }
开发者ID:wemakecustom,项目名称:symfony-app-loader,代码行数:25,代码来源:AppLoader.php

示例2: loadConfiguration

 /**
  * Configures container based on providen config file and profile.
  *
  * @param ContainerInterface $container
  * @param InputInterface     $input
  */
 protected function loadConfiguration(ContainerInterface $container, InputInterface $input)
 {
     $file = $input->getParameterOption(array('--config', '-c'));
     $profile = $input->getParameterOption(array('--profile', '-p')) ?: 'default';
     $cwd = getcwd();
     // if config file is not provided
     if (!$file) {
         // then use behat.yml
         if (is_file($cwd . DIRECTORY_SEPARATOR . 'behat.yml')) {
             $file = $cwd . DIRECTORY_SEPARATOR . 'behat.yml';
             // or behat.yml.dist
         } elseif (is_file($cwd . DIRECTORY_SEPARATOR . 'behat.yml.dist')) {
             $file = $cwd . DIRECTORY_SEPARATOR . 'behat.yml.dist';
             // or config/behat.yml
         } elseif (is_file($cwd . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'behat.yml')) {
             $file = $cwd . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'behat.yml';
         }
     }
     // read configuration
     $loader = new Loader($file);
     $configs = $loader->loadConfiguration($profile);
     // locate base path
     $basePath = $cwd;
     if (file_exists($file)) {
         $basePath = realpath(dirname($file));
     }
     // load core extension into temp container
     $extension = new BehatExtension($basePath);
     $extension->load($configs, $container);
     $container->addObjectResource($extension);
 }
开发者ID:robintema,项目名称:deshaza.ro,代码行数:37,代码来源:BehatApplication.php

示例3: doRun

 /**
  * {@inheritdoc}
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     $drupal_root = $input->getParameterOption(['--drupal', '-d'], false);
     $env = $input->getParameterOption(array('--env', '-e'), getenv('DRUPAL_ENV') ?: 'prod');
     $debug = getenv('DRUPAL_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod';
     if ($this->isBooted()) {
         if (true === $input->hasParameterOption(array('--shell', '-s'))) {
             $this->runShell($input);
             return 0;
         }
     }
     if (!$this->commandsRegistered) {
         $this->commandsRegistered = $this->registerCommands();
     }
     if ($input) {
         $commandName = $this->getCommandName($input);
     }
     if ($commandName && $this->has($commandName)) {
         $this->searchSettingsFile = false;
     }
     if ($this->isRunningOnDrupalInstance($drupal_root)) {
         $this->setup($env, $debug);
         $this->bootstrap();
     }
     parent::doRun($input, $output);
     if ($this->isBooted()) {
         $kernelHelper = $this->getHelperSet()->get('kernel');
         if ($kernelHelper) {
             $kernelHelper->terminate();
         }
     }
 }
开发者ID:bohemier,项目名称:DrupalConsole,代码行数:35,代码来源:Application.php

示例4: doRun

 public function doRun(InputInterface $input, OutputInterface $output)
 {
     // introspect input without definition
     $config = $input->getParameterOption(array('--config', '-c'));
     $verbose = $input->getParameterOption(array('--verbose', '-v'));
     $bootstrap = $input->getParameterOption(array('--bootstrap', '-b'));
     $profile = $input->getParameterOption(array('--profile', '-p'));
     if (true == $verbose) {
         $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
     }
     $container = $this->getContainer();
     // event dispatcher
     $container['dispatcher'] = new EventDispatcher();
     $container['input'] = $input;
     $container['output'] = $output;
     // config
     /**
      * Process options
      */
     $this->register(new ConfigServiceProvider(), array('config.path' => $config));
     if ($profile) {
         $container['config.profile'] = $profile;
     }
     $overrides = array();
     if ($input->hasParameterOption(array('--verbose', '-v'))) {
         $overrides['verbose'] = true;
     }
     if ($bootstrap) {
         $overrides['bootstrap'] = $bootstrap;
     }
     $container['config.overrides'] = $overrides;
     /**
      * Should overwrite the profile with command line options here
      */
     $profile = $container['profile'];
     if ($profile->bootstrap) {
         $inc = function () use($profile) {
             require $profile->bootstrap;
         };
         $inc();
     }
     // extensions
     foreach ($profile->extensions as $name => $options) {
         $class = "\\DSpec\\Provider\\" . ucfirst($name) . "ServiceProvider";
         if (!class_exists($class)) {
             $class = $name;
             if (!class_exists($class)) {
                 throw new \InvalidArgumentException("class:{$class} not found");
             }
         }
         $this->register(new $class(), (array) $options);
     }
     $container['dspec.command'] = new DSpecCommand($container);
     $this->bootProviders();
     $this->add($container['dspec.command']);
     return parent::doRun($input, $output);
 }
开发者ID:churchcommunitybuilder,项目名称:dspec,代码行数:57,代码来源:DSpecApplication.php

示例5: doRun

 /**
  * {@inheritDoc}
  */
 public function doRun(InputInterface $input = null, OutputInterface $output = null)
 {
     $env = $input->getParameterOption('--env', null);
     if (null === $env) {
         $env = $input->getParameterOption('-e', 'dev');
     }
     $this->app = new SilexApplication($env);
     $this->app->boot();
     return parent::doRun($input, $output);
 }
开发者ID:yohang,项目名称:satis-admin,代码行数:13,代码来源:Application.php

示例6: findFiles

 /**
  * @param InputInterface $input
  *
  * @return array
  * @throws \Exception
  */
 public static function findFiles(InputInterface $input)
 {
     if ($input->hasParameterOption('--config-file')) {
         $file = $input->getParameterOption('--config-file');
         if (file_exists($file)) {
             return [$file];
         }
         throw new ConfigurationFileNotFoundException(sprintf("Couldn't find the configuration file: %s", $file));
     }
     $format = $input->hasParameterOption('--config-format') ? $input->getParameterOption('--config-format') : static::$DEFAULT_TYPE;
     return [sprintf("%s.%s", static::$NAME, $format), sprintf("%s.%s.dist", static::$NAME, $format)];
 }
开发者ID:kangkot,项目名称:bldr,代码行数:18,代码来源:Config.php

示例7: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     MinkContext::$allowed = array('servers' => $this->getContainer()->getParameter('behat.servers'), 'locales' => $this->getContainer()->getParameter('behat.locales'));
     MinkContext::$options = $this->getContainer()->getParameter('behat.options');
     foreach (self::$options as $option) {
         if ($input->hasParameterOption('--' . $option)) {
             MinkContext::$options[$option] = $input->getParameterOption('--' . $option);
         }
     }
     $args = array();
     if ($input->hasParameterOption('--suite')) {
         $args['--suite'] = $input->getParameterOption('--suite');
     }
     $this->runBehatCommand($args);
 }
开发者ID:pigroupe,项目名称:SfynxBehatBundle,代码行数:18,代码来源:BehatCommand.php

示例8: doRun

 public function doRun(InputInterface $input, OutputInterface $output)
 {
     if ($input->hasParameterOption('--base-dir')) {
         $baseDir = realpath($input->getParameterOption('--base-dir'));
         if (!is_dir($baseDir)) {
             throw new \InvalidArgumentException(sprintf('Base directory does not exist or it is not a readable directory: "%s".', $input->getParameterOption('--base-dir')));
         }
         // We have to load extension after the override of `base_dir`
         // configuration; because extension can rely on configuration inside the
         // `config.yml` file.
         $this->container['base_dir'] = $baseDir;
     }
     $this->loadExtensions();
     return parent::doRun($input, $output);
 }
开发者ID:carew,项目名称:carew,代码行数:15,代码来源:Carew.php

示例9: getNewWorkingDir

 private function getNewWorkingDir(InputInterface $input)
 {
     $workingDir = $input->getParameterOption(array('--working-dir', '-w'));
     if (false !== $workingDir && !is_dir($workingDir)) {
         throw new \RuntimeException('Invalid working directory specified, ' . $workingDir . ' does not exist.');
     }
     return $workingDir;
 }
开发者ID:pixelpolishers,项目名称:resolver-builder,代码行数:8,代码来源:Application.php

示例10: getWikiDir

 private function getWikiDir(InputInterface $input)
 {
     $wikiDir = $input->getParameterOption(array('--wiki-dir', '-d'));
     if (false !== $wikiDir && !is_dir($wikiDir)) {
         throw new \RuntimeException('Invalid wiki directory specified.');
     }
     return $wikiDir;
 }
开发者ID:gitiki,项目名称:gitiki,代码行数:8,代码来源:Console.php

示例11: getValue

 private function getValue(InputInterface $input, $varName)
 {
     $envVarName = sprintf('INSIGHT_%s', str_replace(' ', '_', strtoupper($varName)));
     if ($value = getenv($envVarName)) {
         return $value;
     }
     $cliVarName = sprintf('--%s', str_replace(' ', '-', strtolower($varName)));
     return $input->getParameterOption($cliVarName);
 }
开发者ID:sensiolabs,项目名称:insight,代码行数:9,代码来源:ConfigurationHelper.php

示例12: getKernel

 /**
  * @return KernelInterface
  */
 private function getKernel(InputInterface $input)
 {
     $env = $input->getParameterOption(['--env', '-e'], $this->baseKernel->getEnvironment());
     $debug = !$input->hasParameterOption(['--no-debug', '']);
     if ($env === $this->baseKernel->getEnvironment() && $debug === $this->baseKernel->isDebug()) {
         return $this->baseKernel;
     }
     $kernelClass = new ReflectionClass($this->baseKernel);
     return $kernelClass->newInstance([$env, $debug]);
 }
开发者ID:blutch89,项目名称:library-sf2,代码行数:13,代码来源:CommandExecuter.php

示例13: buildContainer

 private function buildContainer(InputInterface $input, OutputInterface $output)
 {
     $factory = new ContainerFactory();
     $resolver = new ExtensionNameResolver();
     foreach ($input->getParameterOption(array('extensions', 'e'), array()) as $extension) {
         $factory->addExtension($resolver->resolve($extension));
     }
     $factory->addExtension(new CliExtension($input, $output));
     return $factory->createContainer();
 }
开发者ID:wouterj,项目名称:docbot,代码行数:10,代码来源:Application.php

示例14: doRun

 public function doRun(InputInterface $input, OutputInterface $output)
 {
     $configFile = $input->getParameterOption(array('--config', '-c'));
     if (!is_readable($configFile)) {
         $configFile = 'config.yml';
     }
     $container = $this->createContainer($configFile);
     $filterCommand = new FilterCommand($container);
     $this->add($filterCommand);
     return parent::doRun($input, $output);
 }
开发者ID:tmf,项目名称:logfilter,代码行数:11,代码来源:Application.php

示例15: execute

 /**
  * {@inheritDoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $application = $this->getApplication();
     DoctrineCommandHelper::setApplicationPHPCRSession($application, $input->getOption('session'));
     $helperSet = $application->getHelperSet();
     $helperSet->set($this->getContainer()->get('doctrine_phpcr.console_dumper'));
     if (!$input->getParameterOption('max_line_length') && $this->getContainer()->hasParameter('doctrine_phpcr.dump_max_line_length')) {
         $input->setOption('max_line_length', $this->getContainer()->getParameter('doctrine_phpcr.dump_max_line_length'));
     }
     return parent::execute($input, $output);
 }
开发者ID:nikophil,项目名称:cmf-tests,代码行数:14,代码来源:NodeDumpCommand.php


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