当前位置: 首页>>代码示例>>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;未经允许,请勿转载。