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


PHP Application::setVersion方法代碼示例

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


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

示例1: __construct

 /**
  * @param Application $application
  * @param Container $services
  */
 public function __construct(Application $application, Container $services = null)
 {
     $application->setName('Samurai console');
     $application->setVersion('0.0.0');
     $this->setApplication($application);
     $this->setServices($services ?: $this->buildServices());
     $this->initCommands();
 }
開發者ID:raphhh,項目名稱:samurai,代碼行數:12,代碼來源:Samurai.php

示例2: createService

 /**
  * {@inheritDoc}
  * @return Application
  */
 public function createService(ServiceLocatorInterface $sl)
 {
     $cli = new Application();
     $cli->setName('SmartCrud Command Line Interface');
     $cli->setVersion(Version::VERSION);
     // Load commands using event
     $this->getEventManager($sl)->trigger('loadCli.post', $cli, array('ServiceManager' => $sl));
     return $cli;
 }
開發者ID:phpro,項目名稱:zf-smartcrud,代碼行數:13,代碼來源:ApplicationFactory.php

示例3: createService

 public function createService(ServiceLocatorInterface $sl)
 {
     $cli = new Application();
     $cli->setName('DoctrineModule Command Line Interface');
     $cli->setVersion(Version::VERSION);
     $cli->setHelperSet(new HelperSet());
     // Load commands using event
     $this->events($sl)->trigger('loadCli.post', $cli, array('ServiceManager' => $sl));
     return $cli;
 }
開發者ID:raykolbe,項目名稱:DoctrineModule,代碼行數:10,代碼來源:CliFactory.php

示例4: __invoke

 /**
  * {@inheritDoc}
  * @return Application
  */
 public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
 {
     $cli = new Application();
     $cli->setName('DoctrineModule Command Line Interface');
     $cli->setVersion(Version::VERSION);
     $cli->setHelperSet(new HelperSet());
     $cli->setCatchExceptions(true);
     $cli->setAutoExit(false);
     // Load commands using event
     $this->getEventManager($container)->trigger('loadCli.post', $cli, array('ServiceManager' => $container));
     return $cli;
 }
開發者ID:TomHAnderson,項目名稱:DoctrineModule,代碼行數:16,代碼來源:CliFactory.php

示例5: run

 public static function run()
 {
     // Create the instance
     $app = new ConsoleApp();
     $app->setName(self::NAME);
     $app->setVersion(self::VERSION);
     // Remove default options. We only keep help & version.
     $options = $app->getDefinition()->getOptions();
     $options = [$options['version'], $options['help']];
     $app->getDefinition()->setOptions($options);
     // TODO: Use a more comfortable way to handle included commands (configuration file / autoload / whatever)
     // Add some commands
     $app->add(new Main());
     // Lets go...
     $app->run();
 }
開發者ID:mrccnt,項目名稱:phar-skeleton,代碼行數:16,代碼來源:Application.php

示例6: register

 /**
  * Use the register method to register items with the container via the
  * protected $this->container property or the `getContainer` method
  * from the ContainerAwareTrait.
  */
 public function register()
 {
     $this->container->share(Application::class, function () {
         $console = new Application();
         $console->setName('Glue');
         $console->setVersion(Glue::VERSION);
         // Register commands
         if ($this->container->has('config.commands')) {
             $commands = $this->container->get('config.commands');
             foreach ($commands as $command) {
                 $command = is_string($command) ? $this->container->get($command) : $command;
                 $console->add($command);
             }
         }
         return $console;
     });
     $this->container->add('console', function () {
         return $this->container->get(Application::class);
     });
 }
開發者ID:bramdevries,項目名稱:glue,代碼行數:25,代碼來源:ConsoleServiceProvider.php

示例7: createService

 /**
  * Create service
  *
  * @param ServiceLocatorInterface $services
  * @return Console\Application
  */
 public function createService(ServiceLocatorInterface $services)
 {
     $app = new Console\Application();
     $config = $services->get('Config');
     $config = $config['rdn_console'];
     if (isset($config['application']['name'])) {
         $app->setName($config['application']['name']);
     }
     if (isset($config['application']['version'])) {
         $app->setVersion($config['application']['version']);
     }
     if (!empty($config['commands'])) {
         $commands = $services->get('RdnConsole\\Command\\CommandManager');
         foreach ($config['commands'] as $name) {
             /** @var CommandInterface $command */
             $command = $commands->get($name);
             $app->add($command->getAdapter());
         }
     }
     return $app;
 }
開發者ID:radnan,項目名稱:rdn-console,代碼行數:27,代碼來源:Application.php

示例8: register

 /**
  * Registers services on the given container.
  *
  * This method should only be used to configure services and parameters.
  * It should not get services.
  *
  * @param Container $pimple An Container instance
  */
 public function register(Container $pimple)
 {
     $pimple['console'] = function () use($pimple) {
         $console = new Application();
         $console->setName($pimple['config']['application']['name']);
         $console->setVersion($pimple['version']);
         // Application
         $console->add(new Command\InfoCommand($pimple));
         // Project
         $console->add(new Command\Project\ShowCommand($pimple));
         // $console->add(new Command\Project\CreateCommand($pimple));
         // $console->add(new Command\Project\DeleteCommand($pimple));
         // Server
         // $console->add(new Command\Server\AddCommand($pimple));
         // $console->add(new Command\Server\RemoveCommand($pimple));
         $console->add(new Command\Server\TestCommand($pimple));
         $console->add(new Command\Server\ListCommand($pimple));
         // Deploy
         $console->add(new Command\Deploy\TestCommand($pimple));
         $console->add(new Command\Deploy\DeployCommand($pimple));
         // Tool
         // $console->add(new Command\Tool\CreateKeyCommand($pimple));
         // Dev
         $console->add(new Command\Dev\DumpConfigCommand($pimple));
         $console->add(new Command\Dev\TestCommand($pimple));
         return $console;
     };
     $pimple['console.style.warning'] = function () use($pimple) {
         $style = new OutputFormatterStyle('yellow');
         return $style;
     };
     $pimple['console.style.success'] = function () use($pimple) {
         $style = new OutputFormatterStyle('green');
         return $style;
     };
 }
開發者ID:mykanoa,項目名稱:kanoa,代碼行數:44,代碼來源:ConsoleServiceProvider.php

示例9: testSetGetVersion

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

示例10: setNameAndVersion

 /**
  * @param Go $message
  */
 private function setNameAndVersion(Go $message)
 {
     $this->console->setName($message->title);
     $this->console->setVersion($message->version);
 }
開發者ID:somos,項目名稱:framework,代碼行數:8,代碼來源:GoHandler.php

示例11: initConsoleApplication

 /**
  * Initializes the Console Application that is responsible for CLI interactions.
  */
 public function initConsoleApplication()
 {
     $this['console'] = $this->share(function (Application $app) {
         $console = new ConsoleApplication();
         $console->setName('Bolt console tool - Nut');
         $console->setVersion($app->getVersion());
         return $console;
     });
 }
開發者ID:ArdKuijpers,項目名稱:bolt,代碼行數:12,代碼來源:Application.php

示例12: Application

<?php

use BambooSeeder\Commands\SeedCommand;
use Symfony\Component\Console\Application;
// Deals with installation inside /vendor or out.
foreach ([__DIR__ . '/../../../autoload.php', __DIR__ . '/../vendor/autoload.php'] as $file) {
    if (file_exists($file)) {
        require $file;
        break;
    }
}
$application = new Application();
$application->setName('bseed');
$application->setVersion('1.0.2');
$application->add(new SeedCommand());
$application->run();
開發者ID:bretticus,項目名稱:bseed,代碼行數:16,代碼來源:bseed.php

示例13: realpath

<?php

use Luke\Console\Command;
use Symfony\Component\Console\Application;
ini_set('error_reporting', -1);
ini_set('display_errors', 'On');
define('DS', DIRECTORY_SEPARATOR);
if ('phar://' === substr(__FILE__, 0, 7)) {
    $basePath = 'phar://' . (include 'phar_name.php');
} else {
    $basePath = realpath(dirname(__FILE__));
}
require $basePath . DS . 'vendor' . DS . 'autoload.php';
require $basePath . DS . 'src' . DS . 'Autoloader.php';
Autoloader::register($basePath . DS . 'src');
$application = new Application();
$application->setName('Electrum/Luke');
$application->setVersion('v0.1');
$application->add(new Command\Test());
$application->run();
開發者ID:zolex,項目名稱:console_phar_app,代碼行數:20,代碼來源:app.php


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