本文整理匯總了PHP中Symfony\Component\Console\Input\InputInterface::getFirstArgument方法的典型用法代碼示例。如果您正苦於以下問題:PHP InputInterface::getFirstArgument方法的具體用法?PHP InputInterface::getFirstArgument怎麽用?PHP InputInterface::getFirstArgument使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\Console\Input\InputInterface
的用法示例。
在下文中一共展示了InputInterface::getFirstArgument方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: validate
/**
* @throws InvalidCommitMessageException
*/
public function validate()
{
$this->outputHandler->setTitle('Checking commit message');
$this->outputHandler->getTitle();
$commitMessage = $this->extractCommitMessage->extract($this->input->getFirstArgument());
if (!$this->isValidMessage($commitMessage)) {
throw new InvalidCommitMessageException();
}
$this->outputHandler->getSuccessfulStepMessage();
}
示例2: getCommandName
protected function getCommandName(InputInterface $input)
{
if (!$input->hasParameterOption(array('--config', '-c')) && !$input->getFirstArgument()) {
return 'list';
}
return 'logfilter';
}
示例3: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$commandName = $input->getFirstArgument();
$enable = false !== strpos($commandName, 'enable');
$full = $input->getOption('full');
$config = Config::getInstance();
$development = $config->Development;
if ($enable) {
$development['enabled'] = 1;
if ($full) {
$development['disable_merged_assets'] = 1;
}
$message = 'Development mode enabled';
} else {
$development['enabled'] = 0;
if ($full) {
$development['disable_merged_assets'] = 0;
}
$message = 'Development mode disabled';
}
$config->Development = $development;
$config->forceSave();
Filesystem::deleteAllCacheOnUpdate();
$this->writeSuccessMessage($output, array($message));
}
示例4: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
if (false !== strpos($input->getFirstArgument(), ':l')) {
$output->writeln('<comment>The use of "yaml:lint" command is deprecated since version 2.7 and will be removed in 3.0. Use the "lint:yaml" instead.</comment>');
}
$filename = $input->getArgument('filename');
if (!$filename) {
if (0 !== ftell(STDIN)) {
throw new \RuntimeException('Please provide a filename or pipe file content to STDIN.');
}
$content = '';
while (!feof(STDIN)) {
$content .= fread(STDIN, 1024);
}
return $this->display($input, $output, array($this->validate($content)));
}
if (0 !== strpos($filename, '@') && !is_readable($filename)) {
throw new \RuntimeException(sprintf('File or directory "%s" is not readable', $filename));
}
$files = array();
if (is_file($filename)) {
$files = array($filename);
} elseif (is_dir($filename)) {
$files = Finder::create()->files()->in($filename)->name('*.yml');
} else {
$dir = $this->getApplication()->getKernel()->locateResource($filename);
$files = Finder::create()->files()->in($dir)->name('*.yml');
}
$filesInfo = array();
foreach ($files as $file) {
$filesInfo[] = $this->validate(file_get_contents($file), $file);
}
return $this->display($input, $output, $filesInfo);
}
示例5: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$stdout = $output;
$output = new SymfonyStyle($input, $output);
if (false !== strpos($input->getFirstArgument(), ':l')) {
$output->caution('The use of "twig:lint" command is deprecated since version 2.7 and will be removed in 3.0. Use the "lint:twig" instead.');
}
$twig = $this->getTwigEnvironment();
if (null === $twig) {
$output->error('The Twig environment needs to be set.');
return 1;
}
$filenames = $input->getArgument('filename');
if (0 === count($filenames)) {
if (0 !== ftell(STDIN)) {
throw new \RuntimeException('Please provide a filename or pipe template content to STDIN.');
}
$template = '';
while (!feof(STDIN)) {
$template .= fread(STDIN, 1024);
}
return $this->display($input, $stdout, $output, array($this->validate($twig, $template, uniqid('sf_'))));
}
$filesInfo = $this->getFilesInfo($twig, $filenames);
return $this->display($input, $stdout, $output, $filesInfo);
}
示例6: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
if (false !== strpos($input->getFirstArgument(), ':d')) {
$output->writeln('<comment>The use of "config:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:config" instead.</comment>');
}
$name = $input->getArgument('name');
if (empty($name)) {
$this->listBundles($output);
return;
}
$extension = $this->findExtension($name);
$kernel = $this->getContainer()->get('kernel');
$method = new \ReflectionMethod($kernel, 'buildContainer');
$method->setAccessible(true);
$container = $method->invoke($kernel);
$configs = $container->getExtensionConfig($extension->getAlias());
$configuration = $extension->getConfiguration($configs, $container);
$this->validateConfiguration($extension, $configuration);
$configs = $container->getParameterBag()->resolveValue($configs);
$processor = new Processor();
$config = $processor->processConfiguration($configuration, $configs);
if ($name === $extension->getAlias()) {
$output->writeln(sprintf('# Current configuration for extension with alias: "%s"', $name));
} else {
$output->writeln(sprintf('# Current configuration for "%s"', $name));
}
$output->writeln(Yaml::dump(array($extension->getAlias() => $config), 3));
}
示例7: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
if (false !== strpos($input->getFirstArgument(), ':d')) {
$output->writeln('<comment>The use of "twig:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:twig" instead.</comment>');
}
parent::execute($input, $output);
}
示例8: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
if (false !== strpos($input->getFirstArgument(), ':d')) {
$output->writeln('<comment>The use of "container:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:container" instead.</comment>');
}
$this->validateInput($input);
if ($input->getOption('parameters')) {
$object = $this->getContainerBuilder()->getParameterBag();
$options = array();
} elseif ($parameter = $input->getOption('parameter')) {
$object = $this->getContainerBuilder();
$options = array('parameter' => $parameter);
} elseif ($input->getOption('tags')) {
$object = $this->getContainerBuilder();
$options = array('group_by' => 'tags', 'show_private' => $input->getOption('show-private'));
} elseif ($tag = $input->getOption('tag')) {
$object = $this->getContainerBuilder();
$options = array('tag' => $tag, 'show_private' => $input->getOption('show-private'));
} elseif ($name = $input->getArgument('name')) {
$object = $this->getContainerBuilder();
$name = $this->findProperServiceName($input, $output, $object, $name);
$options = array('id' => $name);
} else {
$object = $this->getContainerBuilder();
$options = array('show_private' => $input->getOption('show-private'));
}
$helper = new DescriptorHelper();
$options['format'] = $input->getOption('format');
$options['raw_text'] = $input->getOption('raw');
$helper->describe($output, $object, $options);
if (!$input->getArgument('name') && $input->isInteractive()) {
$output->writeln('To search for a service, re-run this command with a search term. <comment>debug:container log</comment>');
}
}
示例9: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$output = new SymfonyStyle($input, $output);
if (false !== strpos($input->getFirstArgument(), ':d')) {
$output->caution('The use of "config:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:config" instead.');
}
$name = $input->getArgument('name');
if (empty($name)) {
$output->comment('Provide the name of a bundle as the first argument of this command to dump its configuration.');
$output->newLine();
$this->listBundles($output);
return;
}
$extension = $this->findExtension($name);
$container = $this->compileContainer();
$configs = $container->getExtensionConfig($extension->getAlias());
$configuration = $extension->getConfiguration($configs, $container);
$this->validateConfiguration($extension, $configuration);
$configs = $container->getParameterBag()->resolveValue($configs);
$processor = new Processor();
$config = $processor->processConfiguration($configuration, $configs);
if ($name === $extension->getAlias()) {
$output->title(sprintf('Current configuration for extension with alias "%s"', $name));
} else {
$output->title(sprintf('Current configuration for "%s"', $name));
}
$output->writeln(Yaml::dump(array($extension->getAlias() => $config), 3));
}
示例10: getCommandName
/**
* Gets the name of the command based on input.
*
* @param InputInterface $input The input interface
*
* @return string The command name
*/
protected function getCommandName(InputInterface $input)
{
if ($input->getFirstArgument() === null && !$input->hasParameterOption(array('--help', '-h'))) {
$this->isDefault = true;
return $this->getDefaultCommandName();
}
return parent::getCommandName($input);
}
示例11: isCreate
protected function isCreate(InputInterface $input)
{
$cmd = explode(':', $input->getFirstArgument(), 2);
if (substr_compare('create', $cmd[1], 0, strlen($cmd[1])) === 0) {
return true;
}
return $input->getOption('create');
}
示例12: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
if (false !== strpos($input->getFirstArgument(), ':d')) {
$io->caution('The use of "twig:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:twig" instead.');
}
parent::execute($input, $io);
}
示例13: doRun
/**
* Runs the current application.
*
* Always show the version information except when the user invokes the help
* command as that already does it
*
* @param InputInterface $input An Input instance
* @param OutputInterface $output An Output instance
* @return integer 0 if everything went fine, or an error code otherwise
*/
public function doRun(InputInterface $input, OutputInterface $output)
{
if ($this->showWelcomeMessage && $input->hasParameterOption(array('--help', '-h')) === false && $input->getFirstArgument() !== null) {
$output->writeln($this->getLongVersion());
$output->writeln('');
}
return parent::doRun($input, $output);
}
示例14: doRun
public function doRun(InputInterface $input, OutputInterface $output)
{
$output->writeln('Tombstone Analyzer ' . $this->getVersion());
if (!$input->getFirstArgument()) {
$input = new ArrayInput(array('--help'));
}
AbstractApplication::doRun($input, $output);
}
示例15: getCommandName
protected function getCommandName(InputInterface $input)
{
try {
return $this->find('server:' . $input->getFirstArgument())->getName();
} catch (CommandNotFoundException $e) {
return parent::getCommandName($input);
}
}