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


PHP Application::getName方法代碼示例

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


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

示例1: getApplicationDocument

 /**
  * @param Application $application
  * @param string|null $namespace
  *
  * @return \DOMDocument
  */
 public function getApplicationDocument(Application $application, $namespace = null)
 {
     $dom = new \DOMDocument('1.0', 'UTF-8');
     $dom->appendChild($rootXml = $dom->createElement('symfony'));
     if ($application->getName() !== 'UNKNOWN') {
         $rootXml->setAttribute('name', $application->getName());
         if ($application->getVersion() !== 'UNKNOWN') {
             $rootXml->setAttribute('version', $application->getVersion());
         }
     }
     $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
     $description = new ApplicationDescription($application, $namespace);
     if ($namespace) {
         $commandsXML->setAttribute('namespace', $namespace);
     }
     foreach ($description->getCommands() as $command) {
         $this->appendDocument($commandsXML, $this->getCommandDocument($command));
     }
     if (!$namespace) {
         $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
         foreach ($description->getNamespaces() as $namespaceDescription) {
             $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
             $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
             foreach ($namespaceDescription['commands'] as $name) {
                 $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
                 $commandXML->appendChild($dom->createTextNode($name));
             }
         }
     }
     return $dom;
 }
開發者ID:Ener-Getick,項目名稱:symfony,代碼行數:37,代碼來源:XmlDescriptor.php

示例2: __construct

 /**
  * Constructor.
  *
  * If there is no readline support for the current PHP executable
  * a \RuntimeException exception is thrown.
  *
  * @param Application $application An application instance
  *
  * @throws \RuntimeException When Readline extension is not enabled
  */
 public function __construct(Application $application)
 {
     $this->hasReadline = function_exists('readline');
     $this->application = $application;
     $this->history = getenv('HOME') . '/.history_' . $application->getName();
     $this->output = new ConsoleOutput();
     $this->prompt = $application->getName() . ' > ';
 }
開發者ID:BatVane,項目名稱:Codeception,代碼行數:18,代碼來源:Shell.php

示例3: __construct

 /**
  * Constructor.
  *
  * If there is no readline support for the current PHP executable
  * a \RuntimeException exception is thrown.
  *
  * @param Application $application An application instance
  */
 public function __construct(Application $application)
 {
     @trigger_error('The ' . __CLASS__ . ' class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
     $this->hasReadline = function_exists('readline');
     $this->application = $application;
     $this->history = getenv('HOME') . '/.history_' . $application->getName();
     $this->output = new ConsoleOutput();
 }
開發者ID:Kyra2778,項目名稱:AMR,代碼行數:16,代碼來源:Shell.php

示例4:

 function it_should_wrap_getApplication_in_a_shell(Application $app, HelperSet $helperSet)
 {
     $app->getHelperSet()->willReturn($helperSet);
     $app->getName()->willReturn('test');
     $this->setApplication($app);
     $shell = $this->getShell();
     $shell->shouldHaveType('Symfony\\Component\\Console\\Shell');
 }
開發者ID:niden,項目名稱:task,代碼行數:8,代碼來源:ShellCommandSpec.php

示例5: __construct

 /**
  * Constructor.
  *
  * If there is no readline support for the current PHP executable
  * a \RuntimeException exception is thrown.
  *
  * @param Application $application An application instance
  *
  * @throws \RuntimeException When Readline extension is not enabled
  */
 public function __construct(Application $application)
 {
     if (!function_exists('readline')) {
         throw new \RuntimeException('Unable to start the shell as the Readline extension is not enabled.');
     }
     $this->application = $application;
     $this->history = getenv('HOME') . '/.history_' . $application->getName();
     $this->output = new ConsoleOutput();
 }
開發者ID:artz20,項目名稱:Tv-shows-zone,代碼行數:19,代碼來源:Shell.php

示例6: describeApplication

 /**
  * {@inheritdoc}
  */
 protected function describeApplication(Application $application, array $options = array())
 {
     $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
     $description = new ApplicationDescription($application, $describedNamespace);
     $blocks = array($application->getName() . "\n" . str_repeat('=', strlen($application->getName())));
     foreach ($description->getNamespaces() as $namespace) {
         if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
             $blocks[] = '**' . $namespace['id'] . ':**';
         }
         $blocks[] = implode("\n", array_map(function ($commandName) {
             return '* ' . $commandName;
         }, $namespace['commands']));
     }
     foreach ($description->getCommands() as $command) {
         $blocks[] = $this->describeCommand($command);
     }
     return implode("\n\n", $blocks);
 }
開發者ID:Tarendai,項目名稱:spring-website,代碼行數:21,代碼來源:MarkdownDescriptor.php

示例7: describeApplication

 /**
  * {@inheritdoc}
  */
 protected function describeApplication(Application $application, array $options = array())
 {
     $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
     $description = new ApplicationDescription($application, $describedNamespace);
     $commands = array();
     foreach ($description->getCommands() as $command) {
         $commands[] = $this->getCommandData($command);
     }
     $data = array();
     if ('UNKNOWN' !== $application->getName()) {
         $data['application']['name'] = $application->getName();
         if ('UNKNOWN' !== $application->getVersion()) {
             $data['application']['version'] = $application->getVersion();
         }
     }
     $data['commands'] = $commands;
     if ($describedNamespace) {
         $data['namespace'] = $describedNamespace;
     } else {
         $data['namespaces'] = array_values($description->getNamespaces());
     }
     $this->writeData($data, $options);
 }
開發者ID:symfony,項目名稱:symfony,代碼行數:26,代碼來源:JsonDescriptor.php

示例8: testSetGetName

 public function testSetGetName()
 {
     $application = new Application();
     $application->setName('foo');
     $this->assertEquals('foo', $application->getName(), '->setName() sets the name of the application');
 }
開發者ID:Ener-Getick,項目名稱:symfony,代碼行數:6,代碼來源:ApplicationTest.php


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