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


PHP Command::getDescription方法代碼示例

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


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

示例1: configure

 /**
  * {@inheritDoc}
  */
 protected function configure()
 {
     if ($this->isVersionCompatible()) {
         $this->command = $this->createCommand();
         $this->setHelp($this->command->getHelp());
         $this->setDefinition($this->command->getDefinition());
         $this->setDescription($this->command->getDescription());
     }
     $this->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
 }
開發者ID:brookinsconsulting,項目名稱:ezecosystem,代碼行數:13,代碼來源:DelegateCommand.php

示例2: describeCommand

 /**
  * @inheritdoc
  */
 protected function describeCommand(Command $command, array $options = [])
 {
     $command->getSynopsis();
     $command->mergeApplicationDefinition(false);
     $this->write($command->getName() . "\n" . str_repeat('-', strlen($command->getName())) . "\n");
     if ($description = $command->getDescription()) {
         $this->write("{$description}\n\n");
     }
     $aliases = $command instanceof CommandBase ? $command->getVisibleAliases() : $command->getAliases();
     if ($aliases) {
         $this->write('Aliases: ' . '`' . implode('`, `', $aliases) . '`' . "\n\n");
     }
     $executableName = 'platform';
     $this->write("## Usage:\n\n```\n{$executableName} " . $command->getSynopsis() . "\n```\n\n");
     if ($help = $command->getProcessedHelp()) {
         $this->write($help);
         $this->write("\n\n");
     }
     if ($command->getNativeDefinition()) {
         $this->describeInputDefinition($command->getNativeDefinition());
         $this->write("\n\n");
     }
     if ($command instanceof CommandBase && ($examples = $command->getExamples())) {
         $this->write('## Examples');
         $this->write("\n");
         $name = $command->getName();
         foreach ($examples as $arguments => $description) {
             $this->write("\n* {$description}:  \n  ```\n  platform {$name} {$arguments}\n  ```\n");
         }
         $this->write("\n");
     }
 }
開發者ID:drewmelck,項目名稱:platformsh-cli,代碼行數:35,代碼來源:CustomMarkdownDescriptor.php

示例3: describeCommand

 /**
  * {@inheritdoc}
  */
 protected function describeCommand(Command $command, array $options = array())
 {
     $command->getSynopsis();
     $command->mergeApplicationDefinition(false);
     $this->write('`' . $command->getName() . "`\n" . str_repeat('-', strlen($command->getName()) + 2) . "\n\n" . ($command->getDescription() ? $command->getDescription() . "\n\n" : '') . '### Usage' . "\n\n" . array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
         return $carry . '* `' . $usage . '`' . "\n";
     }));
     if ($help = $command->getProcessedHelp()) {
         $this->write("\n");
         $this->write($help);
     }
     if ($command->getNativeDefinition()) {
         $this->write("\n\n");
         $this->describeInputDefinition($command->getNativeDefinition());
     }
 }
開發者ID:symfony,項目名稱:symfony,代碼行數:19,代碼來源:MarkdownDescriptor.php

示例4: describeCommand

 /**
  * @inheritdoc
  */
 protected function describeCommand(Command $command, array $options = array())
 {
     $command->getSynopsis();
     $command->mergeApplicationDefinition(false);
     $this->writeText("<comment>Command:</comment> " . $command->getName(), $options);
     if ($aliases = $command->getAliases()) {
         $this->writeText("\n");
         $this->writeText('<comment>Aliases:</comment> ' . implode(', ', $aliases), $options);
     }
     if ($description = $command->getDescription()) {
         $this->writeText("\n");
         $this->writeText("<comment>Description:</comment> {$description}", $options);
     }
     $this->writeText("\n\n");
     $this->writeText('<comment>Usage:</comment>', $options);
     $this->writeText("\n");
     $this->writeText(' ' . $command->getSynopsis(), $options);
     $this->writeText("\n");
     if ($definition = $command->getNativeDefinition()) {
         $this->writeText("\n");
         $this->describeInputDefinition($definition, $options);
     }
     if ($help = $command->getProcessedHelp()) {
         $this->writeText("\n");
         $this->writeText('<comment>Help:</comment>', $options);
         $this->writeText("\n");
         $this->writeText(' ' . str_replace("\n", "\n ", $help), $options);
         $this->writeText("\n");
     }
 }
開發者ID:pjcdawkins,項目名稱:platformsh-cli,代碼行數:33,代碼來源:CustomTextDescriptor.php

示例5: newJobFound

 protected function newJobFound(EntityManager $em, OutputInterface $output, Command $command, CronJobAnno $anno, $defaultDisabled = false)
 {
     $newJob = new CronJob();
     $newJob->setCommand($command->getName());
     $newJob->setDescription($command->getDescription());
     $newJob->setInterval($anno->value);
     $newJob->setNextRun(new \DateTime());
     $newJob->setEnabled(!$defaultDisabled);
     $output->writeln("Added the job " . $newJob->getCommand() . " with interval " . $newJob->getInterval());
     $em->persist($newJob);
 }
開發者ID:SulivanDotEu,項目名稱:CronBundle,代碼行數:11,代碼來源:CronScanCommand.php

示例6: newJobFound

 protected function newJobFound(EntityManager $em, OutputInterface $output, Command $command, CronJobAnno $anno, $defaultDisabled = false)
 {
     $nextRun = $this->getNextRun($anno);
     $newJob = new CronJob();
     $newJob->setCommand($command->getName());
     $newJob->setDescription($command->getDescription());
     $newJob->setInterval($anno->interval);
     $newJob->setNextRun($nextRun);
     $newJob->setEnabled(!$defaultDisabled);
     $output->writeln("Added the job " . $newJob->getCommand() . " with interval " . $newJob->getInterval() . " with the next run at " . $nextRun->format('Y-m-d H:i:s'));
     $em->persist($newJob);
 }
開發者ID:qooplmao,項目名稱:CronBundle,代碼行數:12,代碼來源:CronScanCommand.php

示例7: describeCommand

 /**
  * {@inheritdoc}
  */
 protected function describeCommand(Command $command, array $options = array())
 {
     $command->getSynopsis();
     $command->mergeApplicationDefinition(false);
     $markdown = $command->getName() . "\n" . str_repeat('-', strlen($command->getName())) . "\n\n" . '* Description: ' . ($command->getDescription() ?: '<none>') . "\n" . '* Usage: `' . $command->getSynopsis() . '`' . "\n" . '* Aliases: ' . (count($command->getAliases()) ? '`' . implode('`, `', $command->getAliases()) . '`' : '<none>');
     if ($help = $command->getProcessedHelp()) {
         $markdown .= "\n\n" . $help;
     }
     if ($definitionMarkdown = $this->describeInputDefinition($command->getNativeDefinition())) {
         $markdown .= "\n\n" . $definitionMarkdown;
     }
     return $markdown;
 }
開發者ID:Tarendai,項目名稱:spring-website,代碼行數:16,代碼來源:MarkdownDescriptor.php

示例8: getCommandDocument

 /**
  * @param Command $command
  *
  * @return \DOMDocument
  */
 public function getCommandDocument(Command $command)
 {
     $dom = new \DOMDocument('1.0', 'UTF-8');
     $dom->appendChild($commandXML = $dom->createElement('command'));
     $command->getSynopsis();
     $command->mergeApplicationDefinition(false);
     $commandXML->setAttribute('id', $command->getName());
     $commandXML->setAttribute('name', $command->getName());
     $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
     foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
         $usagesXML->appendChild($dom->createElement('usage', $usage));
     }
     $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
     $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
     $commandXML->appendChild($helpXML = $dom->createElement('help'));
     $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
     $definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition());
     $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
     return $dom;
 }
開發者ID:Ener-Getick,項目名稱:symfony,代碼行數:25,代碼來源:XmlDescriptor.php

示例9: describeCommand

 /**
  * @inheritdoc
  */
 protected function describeCommand(Command $command, array $options = [])
 {
     $command->getSynopsis();
     $command->mergeApplicationDefinition(false);
     $this->writeText("<comment>Command:</comment> " . $command->getName(), $options);
     $aliases = $command instanceof CommandBase ? $command->getVisibleAliases() : $command->getAliases();
     if ($aliases) {
         $this->writeText("\n");
         $this->writeText('<comment>Aliases:</comment> ' . implode(', ', $aliases), $options);
     }
     if ($description = $command->getDescription()) {
         $this->writeText("\n");
         $this->writeText("<comment>Description:</comment> {$description}", $options);
     }
     $this->writeText("\n\n");
     $this->writeText('<comment>Usage:</comment>', $options);
     $this->writeText("\n");
     $executableName = 'platform';
     $this->writeText(' ' . $executableName . ' ' . $command->getSynopsis(), $options);
     $this->writeText("\n");
     if ($definition = $command->getNativeDefinition()) {
         $this->writeText("\n");
         $this->describeInputDefinition($definition, $options);
         $this->writeText("\n");
     }
     if ($help = $command->getProcessedHelp()) {
         $this->writeText("\n");
         $this->writeText('<comment>Help:</comment>', $options);
         $this->writeText("\n");
         $this->writeText(' ' . str_replace("\n", "\n ", $help), $options);
         $this->writeText("\n");
     }
     if ($command instanceof CommandBase && ($examples = $command->getExamples())) {
         $this->writeText("\n");
         $this->writeText('<comment>Examples:</comment>', $options);
         $name = $command->getName();
         foreach ($examples as $arguments => $description) {
             $this->writeText("\n {$description}:\n   <info>platform {$name} {$arguments}</info>\n");
         }
     }
 }
開發者ID:drewmelck,項目名稱:platformsh-cli,代碼行數:44,代碼來源:CustomTextDescriptor.php

示例10: getDescription

 /**
  * {@inheritdoc}
  */
 public function getDescription()
 {
     return $this->decoratedCommand->getDescription();
 }
開發者ID:frankdejonge,項目名稱:locked-console-command,代碼行數:7,代碼來源:LockedCommandDecorator.php

示例11: getDescription

 public function getDescription()
 {
     return $this->innerCommand->getDescription();
 }
開發者ID:lolautruche,項目名稱:ezsh,代碼行數:4,代碼來源:WrappedCommand.php

示例12: testDescription

 function testDescription()
 {
     assert('run all the tests in the specified directory' === $this->command->getDescription());
 }
開發者ID:phpassert,項目名稱:phpassert,代碼行數:4,代碼來源:TestTestCommand.php

示例13: configure

 protected function configure()
 {
     $this->setName($this->vagrant_ssh . ':' . $this->command->getName())->setDescription('Vagrant SSH ' . $this->command->getDescription())->setDefinition($this->command->getDefinition());
     parent::configure();
 }
開發者ID:performerSpa,項目名稱:PerformerVagrantBundle,代碼行數:5,代碼來源:VagrantSshCommand.php

示例14: describeCommand

 protected function describeCommand(Command $command, array $options = array())
 {
     $dom = new \DOMDocument('1.0', 'UTF-8');
     $dom->appendChild($commandXML = $dom->createElement('command'));
     $command->getSynopsis();
     $command->mergeApplicationDefinition(false);
     $commandXML->setAttribute('id', $command->getName());
     $commandXML->setAttribute('name', $command->getName());
     $commandXML->appendChild($usageXML = $dom->createElement('usage'));
     $usageXML->appendChild($dom->createTextNode(sprintf($command->getSynopsis(), '')));
     $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
     $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
     $commandXML->appendChild($helpXML = $dom->createElement('help'));
     $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
     $commandXML->appendChild($aliasesXML = $dom->createElement('aliases'));
     foreach ($command->getAliases() as $alias) {
         $aliasesXML->appendChild($aliasXML = $dom->createElement('alias'));
         $aliasXML->appendChild($dom->createTextNode($alias));
     }
     $definitionXML = $this->describeInputDefinition($command->getNativeDefinition(), array('as_dom' => true));
     $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
     return $this->output($dom, $options);
 }
開發者ID:lyrixx,項目名稱:email-makr,代碼行數:23,代碼來源:emailmakr.php

示例15: getCommandData

 /**
  * @param Command $command
  *
  * @return array
  */
 private function getCommandData(Command $command)
 {
     $command->getSynopsis();
     $command->mergeApplicationDefinition(false);
     return array('name' => $command->getName(), 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()), 'description' => $command->getDescription(), 'help' => $command->getProcessedHelp(), 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()));
 }
開發者ID:scrobot,項目名稱:Lumen,代碼行數:11,代碼來源:JsonDescriptor.php


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