本文整理汇总了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);
}
示例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;
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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']));
}
示例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;
}
示例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>');
}
}
示例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);
}
示例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>');
}
}
示例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());
}
}
示例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]), []);
}
示例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);
}
示例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;
}