当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::setName方法代码示例

本文整理汇总了PHP中Symfony\Component\Console\Application::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::setName方法的具体用法?PHP Application::setName怎么用?PHP Application::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Console\Application的用法示例。


在下文中一共展示了Application::setName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createService

 /**
  * Sets the dojo theme to use.
  *
  * @param \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator
  * @return \Symfony\Component\Console\Application
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('Config')['sds']['dojo'];
     $configHelper = new \Sds\DojoModule\Tools\Console\Helper\ConfigHelper($config);
     $helperSet = new HelperSet();
     $helperSet->set($configHelper, 'config');
     $cli = new Application();
     $cli->setName('DojoModule Command Line Interface');
     $cli->setHelperSet($helperSet);
     $cli->addCommands(array(new \Sds\DojoModule\Tools\Console\Command\GenerateProfile()));
     return $cli;
 }
开发者ID:ronald132,项目名称:dojoModule,代码行数:18,代码来源:CliFactory.php

示例5: __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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: Application

<?php

require __DIR__ . '/../vendor/autoload.php';
use Symfony\Component\Console\Application;
use Dbcompar\Command\Diff;
use Dbcompar\Command\Sync;
$application = new Application();
$application->setName("Dbcompar");
// $application->setName("
//     _______   ______
//    //      \ //     \
//   //       ///      /
//  //       ///------/
// //_______///
//
//
// ");
$application->add(new Diff());
$application->add(new Sync());
$application->run();
开发者ID:ttmdear,项目名称:dbcompar,代码行数:20,代码来源:bootloader.php

示例11: 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

示例12: 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

示例13: Application

<?php

require_once __DIR__ . "/vendor/autoload.php";
use Symfony\Component\Console\Application;
use CliOtas\Command as Commands;
$application = new Application();
$application->setName('Open Text Adventure System (OTAS)');
$application->add(new Commands\RunCommand());
$application->add(new Commands\MapCommand());
$application->run();
开发者ID:jaytaph,项目名称:otas,代码行数:10,代码来源:otas.php

示例14: 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

示例15: switch

        $key = $this->selectKey($input, $output);
        if ($key) {
            switch ($input->getOption('format')) {
                case 'json':
                    $export = $key->toJSON();
                    break;
                case 'pem':
                    try {
                        $export = $key->toPEM();
                    } catch (\Exception $e) {
                        $output->writeln($e->getMessage());
                    }
                    break;
                default:
                    $output->writeln('Invalid format: ' . $input->getOption('format'));
            }
            if ($input->getOption('output')) {
                file_put_contents($input->getOption('output'), $export);
            } else {
                $output->write($export);
            }
        }
    }
}
$app = new Application();
$app->setName('SimpleJWT JWKS tool');
$app->add(new AddCommand());
$app->add(new ListKeysCommand());
$app->add(new RemoveCommand());
$app->add(new ExportCommand());
$app->run();
开发者ID:kelvinmo,项目名称:simplejwt,代码行数:31,代码来源:jwkstool.php


注:本文中的Symfony\Component\Console\Application::setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。