當前位置: 首頁>>代碼示例>>PHP>>正文


PHP InputInterface::getArguments方法代碼示例

本文整理匯總了PHP中Symfony\Component\Console\Input\InputInterface::getArguments方法的典型用法代碼示例。如果您正苦於以下問題:PHP InputInterface::getArguments方法的具體用法?PHP InputInterface::getArguments怎麽用?PHP InputInterface::getArguments使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\Console\Input\InputInterface的用法示例。


在下文中一共展示了InputInterface::getArguments方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: argument

 /**
  * Get the value of a command argument.
  *
  * @param  string  $key
  * @return string|array
  */
 public function argument($key = null)
 {
     if (is_null($key)) {
         return $this->input->getArguments();
     }
     return $this->input->getArgument($key);
 }
開發者ID:monii,項目名稱:nimble-symfony-console,代碼行數:13,代碼來源:CommandInput.php

示例2: isUpdateWithoutArguments

 /**
  * @return bool
  */
 protected function isUpdateWithoutArguments()
 {
     $arguments = $this->input->getArguments();
     if (!$this->input->getOption('dry-run') && $arguments['command'] === 'update' && count($arguments['packages']) === 0) {
         return true;
     }
     return false;
 }
開發者ID:kisphp,項目名稱:composer-no-update,代碼行數:11,代碼來源:CommandChecker.php

示例3: execute

 /**
  * @param  InputInterface  $input
  * @param  OutputInterface $output
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // handle everything that is not an actual exception
     set_error_handler(function ($errno, $errstr, $errfile, $errline, array $errcontext) use($input) {
         // error was suppressed with the @-operator
         if (0 === error_reporting()) {
             return false;
         }
         $extra = array();
         $tags = array();
         $extra["full_command"] = implode(" ", $_SERVER['argv']);
         $arguments = $input->getArguments();
         $tags["command"] = $arguments["command"];
         $this->dialogProvider->logException(new SkylabException($errstr, 0, $errno, $errfile, $errline, null, array()), $tags, $extra);
     }, E_ALL);
     /** @var \Cilex\Application $app */
     $app = $this->getContainer();
     try {
         $this->setup($app, $input, $output, true);
         $this->doPreExecute();
         $this->doExecute();
         $this->doPostExecute();
     } catch (\Exception $ex) {
         $extra = array();
         $tags = array();
         $extra["full_command"] = implode(" ", $_SERVER['argv']);
         $arguments = $input->getArguments();
         $tags["command"] = $arguments["command"];
         $this->dialogProvider->logException($ex, $tags, $extra);
     }
 }
開發者ID:benoitgeerinck,項目名稱:skylab,代碼行數:36,代碼來源:AbstractCommand.php

示例4: execute

 /**
  * Executes the current command
  *
  * @param use Symfony\Component\Console\Input\InputInterface $input
  * @param use Symfony\Component\Console\Input\OutputIterface $output
  *
  * @return null|int null or 0 if everything went fine, or an error code
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->arguments = $input->getArguments();
     $this->options = $input->getOptions();
     $files = $this->collectFiles($this->arguments['source']);
     if (!count($files)) {
         $output->writeln('<comment>No task found! Please check your source path.</comment>');
         exit;
     }
     // List of schedules
     $schedules = [];
     foreach ($files as $file) {
         $schedule = (require $file->getRealPath());
         if (!$schedule instanceof Schedule) {
             continue;
         }
         // We keep the events which are due and dismiss the rest.
         $schedule->events($schedule->dueEvents());
         if (count($schedule->events())) {
             $schedules[] = $schedule;
         }
     }
     if (!count($schedules)) {
         $output->writeln('<comment>No event is due!</comment>');
         exit;
     }
     // Running the events
     (new EventRunner())->handle($schedules);
 }
開發者ID:lavary,項目名稱:crunz,代碼行數:37,代碼來源:ScheduleRunCommand.php

示例5: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $config = new Config();
     $config->setBasePath(getcwd());
     $config->setFromArray($input->getArguments());
     $config->setFromArray(array('bare' => $input->getOption('bare')));
     $moduleConfig = new ConfigWriter($config);
     $state = new State($moduleConfig);
     $builder = new FullContainer($config);
     $builder->prepare($state);
     $builder->build($state);
     $writeState = new State($moduleConfig);
     $models = array('service' => $state->getServiceModel(), 'factory' => $state->getModel('service-factory'), 'trait' => $state->getModel('service-trait'), 'test' => $state->getModel('service-test'));
     foreach (array_keys($models) as $key) {
         if ($input->getOption('no-' . $key)) {
             $models[$key] = false;
         }
         if ($input->getOption('only-' . $key)) {
             foreach (array_keys($models) as $index) {
                 if ($key != $index) {
                     $models[$index] = false;
                 }
             }
         }
     }
     foreach ($models as $model) {
         if ($model) {
             $writeState->addModel($model);
         }
     }
     $writer = new ModelWriter($config);
     $writer->write($writeState, $output);
     $moduleConfig->save($output);
 }
開發者ID:enlitepro,項目名稱:zf2-scaffold,代碼行數:34,代碼來源:ServiceCommand.php

示例6: argument

 /**
  * Retrieves argument value
  *
  * @param string|null $key The key
  *
  * @return string|array
  */
 public function argument(string $key = null)
 {
     if ($key === null) {
         return $this->input->getArguments();
     }
     return $this->input->getArgument($key);
 }
開發者ID:novuso,項目名稱:common-bundle,代碼行數:14,代碼來源:Command.php

示例7: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $arguments = $input->getArguments();
     // Disable error reporting for shopware menu legacy hack
     $this->registerErrorHandler($output);
     /** @var Installer $themeInstaller */
     $themeInstaller = $this->container->get('theme_installer');
     $themeInstaller->synchronize();
     if ($this->getRepository()->findOneByTemplate($arguments['template'])) {
         $output->writeln('A theme with that name already exists');
         return 1;
     }
     /** @var Template $parent */
     $parent = $this->getRepository()->findOneByTemplate($arguments['parent']);
     if (!$parent instanceof Template) {
         $output->writeln(sprintf('Shop template by template name "%s" not found', $arguments['parent']));
         return 1;
     }
     if ($parent->getVersion() < 3) {
         $output->writeln(sprintf('Shop template by template name "%s" is not a Shopware 5 Theme!', $arguments['parent']));
         return 1;
     }
     $arguments = array_merge($arguments, $this->dialog($input, $output));
     /** @var Generator $themeGenerator */
     $themeGenerator = $this->container->get('theme_generator');
     $themeGenerator->generateTheme($arguments, $parent);
     $output->writeln(sprintf('Theme "%s" has been created successfully.', $arguments['name']));
 }
開發者ID:GerDner,項目名稱:luck-docker,代碼行數:31,代碼來源:ThemeCreateCommand.php

示例8: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $options = array_merge($input->getArguments(), $input->getOptions());
     var_dump($options);
     $this->getClient()->updateAutoScalingGroup($options);
     return self::COMMAND_SUCCESS;
 }
開發者ID:uecode,項目名稱:aws-cli-bundle,代碼行數:7,代碼來源:UpdateAutoScalingGroupCommand.php

示例9: execute

 public function execute(InputInterface $input, OutputInterface $output)
 {
     $args = $input->getArguments();
     $config = $this->getZyncroAppConfig($args['namespace']);
     $helper = new QuestionHelper();
     $newParameters = array();
     if ($config) {
         $output->writeln('');
         $parameters = $this->getParametersFromConfig($config);
         foreach ($parameters as $parameter) {
             if (!isset($newParameters[$parameter['block']])) {
                 $newParameters[$parameter['block']] = array();
             }
             $question = new Question('Set value for parameter <fg=green>' . $parameter['key'] . '</fg=green> of block <fg=green>' . $parameter['block'] . '</fg=green> (default: <fg=yellow>' . $parameter['value'] . '</fg=yellow>): ', $parameter['value']);
             $newParameters[$parameter['block']][$parameter['key']] = $helper->ask($input, $output, $question);
         }
         $dataSaved = $this->saveZyncroAppConfig($args['namespace'], $newParameters);
         if ($dataSaved) {
             $output->writeln('');
             $output->writeln('<info>The new configuration for the ZyncroApp with the namespace ' . $args['namespace'] . ' has been saved</info>');
             $output->writeln('');
         }
     } else {
         $output->writeln('<error>ZyncroApp with namespace ' . $args['namespace'] . ' is not found or doesn\'t have a config.yml file</error>');
     }
 }
開發者ID:zyncro,項目名稱:framework,代碼行數:26,代碼來源:ConfigureZyncroApp.php

示例10: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $data = $input->getArguments();
     /** @var Connection $conn */
     $conn = $this->getContainer()->get('database_connection');
     $conn->insert('queues', $data);
 }
開發者ID:ErikZigo,項目名稱:syrup,代碼行數:7,代碼來源:QueueRegisterCommand.php

示例11: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $arguments = $input->getArguments();
     $arguments['limit'] = $input->getOption('limit');
     $issues = $this->issuesFactory->getIssues($arguments);
     if (isset($issues['issues'])) {
         $tableIssues = [];
         foreach ($issues['issues'] as $key => $issue) {
             // new table layout
             $estimate = '';
             if (isset($issue['estimated_hours'])) {
                 $estimate = str_pad($issue['estimated_hours'], 4, ' ', STR_PAD_LEFT) . 'h';
             }
             $projectId = str_pad($issue['project']['id'], 3, ' ', STR_PAD_LEFT);
             $tableIssues[$key] = ['id' => "<comment>{$issue['id']}</comment>", 'project' => "[{$projectId}] " . substr($issue['project']['name'], 0, 10), 'name' => substr($issue['subject'], 0, 40), 'status' => substr($issue['status']['name'], 0, 8), 'est.' => $estimate];
         }
         if (!empty($tableIssues)) {
             $table = new Table($output);
             $table->setHeaders(array_keys($tableIssues['0']))->setRows($tableIssues);
             $table->render();
         }
         if ($issues['total_count'] == 0) {
             $output->writeln('No issues found: <comment>' . json_encode($arguments) . '</comment>');
         }
     }
     if (isset($issues['0']) && $issues['0'] == false) {
         $output->writeln('No issues found: <comment>' . json_encode($arguments) . '</comment>');
     }
 }
開發者ID:rootindex,項目名稱:redmine-lite-cli,代碼行數:32,代碼來源:ListIssuesCommand.php

示例12: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $args = $input->getArguments();
     $first = array_shift($args);
     // If the first argument is an alias, assign the next argument as the
     // command.
     if (strpos($first, '@') === 0) {
         $alias = $first;
         $command = array_shift($args);
     } else {
         $alias = '@self';
         $command = $first;
     }
     $options = $input->getOptions();
     // Force the 'backend' option to TRUE.
     $options['backend'] = TRUE;
     $return = drush_invoke_process($alias, $command, array_values($args), $options, ['interactive' => TRUE]);
     if ($return['error_status'] > 0) {
         foreach ($return['error_log'] as $error_type => $errors) {
             $output->write($errors);
         }
         // Add a newline after so the shell returns on a new line.
         $output->writeln('');
     } else {
         $output->page(drush_backend_get_result());
     }
 }
開發者ID:bjargud,項目名稱:drush,代碼行數:30,代碼來源:DrushCommand.php

示例13: execute

 /**
  * Executes the current command
  *
  * @param use Symfony\Component\Console\Input\InputInterface $input
  * @param use Symfony\Component\Console\Input\OutputIterface $output
  *
  * @return null|int null or 0 if everything went fine, or an error code
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $args = [];
     $this->arguments = $input->getArguments();
     parse_str($this->arguments['closure'], $args);
     $serializer = new Serializer();
     call_user_func_array($serializer->unserialize($args[0]), []);
 }
開發者ID:lavary,項目名稱:crunz,代碼行數:16,代碼來源:ClosureRunCommand.php

示例14: execute

 public function execute(InputInterface $input, OutputInterface $output)
 {
     if (count($input->getArguments()) === 0) {
         $definition = $this->getDefinition();
         $input = new ArgvInput(null, $definition);
     }
     return parent::execute($input, $output);
 }
開發者ID:alpixel,項目名稱:AlpixelMediaBundle,代碼行數:8,代碼來源:LiipImagineCleanupCommand.php

示例15: execute

 /**
  * {@inheritDoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $options = array_merge($input->getArguments(), $input->getOptions());
     $options['BlockDeviceMappings'] = json_decode($options['BlockDeviceMappings']);
     $result = $this->getClient()->createImage($options);
     $output->writeln('AMI Image created with id ' . $result->get('ImageId'));
     return self::COMMAND_SUCCESS;
 }
開發者ID:uecode,項目名稱:aws-cli-bundle,代碼行數:11,代碼來源:CreateImageCommand.php


注:本文中的Symfony\Component\Console\Input\InputInterface::getArguments方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。