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


PHP Application::setDefaultCommand方法代码示例

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


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

示例1: create

 /**
  * @return Application
  */
 public function create()
 {
     $app = new Application(Message::NAME, Message::VERSION);
     $app->setDefaultCommand(Message::COMMAND);
     $app->add($this->createAnalyzeCommand());
     return $app;
 }
开发者ID:EvKoh,项目名称:PhpDependencyAnalysis,代码行数:10,代码来源:ApplicationFactory.php

示例2: __construct

 /**
  * Constructor
  */
 public function __construct($applicationDir)
 {
     // Init console application
     $this->consoleApplication = new ConsoleApplication();
     // Adding commands
     $commandNotificationSendCommand = new NotificationSendCommand($applicationDir);
     $this->consoleApplication->add($commandNotificationSendCommand);
     $this->consoleApplication->setDefaultCommand($commandNotificationSendCommand->getName());
 }
开发者ID:shakahl,项目名称:pharover,代码行数:12,代码来源:Application.php

示例3: main

 /**
  * command应用主入口
  * @throws \Exception
  */
 static function main()
 {
     $application = new Application();
     $application->addCommands(self::createCommands());
     $application->setDefaultCommand(ThumbnailCommand::COMMAND_NAME);
     $application->run();
 }
开发者ID:slince,项目名称:magic-hand,代码行数:11,代码来源:CommandUI.php

示例4: main

 /**
  * command应用主入口
  * @throws \Exception
  */
 static function main()
 {
     $application = new Application();
     $application->addCommands(self::createCommands());
     $application->setDefaultCommand(self::DEFAULT_COMMAND_NAME);
     $application->run();
 }
开发者ID:slince,项目名称:runner,代码行数:11,代码来源:CommandUI.php

示例5: getApp

function getApp() : Application
{
    $app = new Application();
    $app->add(new TestCommand());
    $app->setDefaultCommand('test');
    return $app;
}
开发者ID:phpassert,项目名称:phpassert,代码行数:7,代码来源:App.php

示例6: execute

 public function execute()
 {
     $console = new Application('');
     $def = new ListCommand();
     $console->add($def);
     $console->setDefaultCommand($def->getName());
     foreach ($this->path as $path) {
         $files = (new FileHandler($path))->readDir();
         foreach ($files as $file) {
             $command = basename($file, '.php');
             if ('BaseCommand' === $command) {
                 continue;
             }
             $console->add($this->fetchCommand($command));
         }
     }
     $output = new ConsoleOutput();
     self::warningText($output);
     self::errorText($output);
     $console->run(null, $output);
 }
开发者ID:eddmash,项目名称:powerorm,代码行数:21,代码来源:Manager.php

示例7: run

 public function run()
 {
     $console = new Application(self::APP_NAME, self::APP_VERSION);
     $console->setDefaultCommand(self::APP_DEFAULT_COMMAND);
     $dispatcher = new EventDispatcher();
     $dispatcher->addListener(ConsoleEvents::COMMAND, function (ConsoleCommandEvent $event) {
         // get the input instance
         // $input = $event->getInput();
         // get the output instance
         $output = $event->getOutput();
         // get the command to be executed
         $command = $event->getCommand();
         // write something about the command
         //$output->writeln(sprintf('Before running command <info>%s</info>', $command->getName()));
         if ($command->getName() == StartServer::CLI_COMMAND) {
             $output->write(self::$BANNER);
         }
         // get the application
         // $application = $command->getApplication();
     });
     $console->setDispatcher($dispatcher);
     $console->addCommands([new Controller\StartServer(), new Controller\StopServer(), new Controller\ListServers(), new Controller\RegisterServer()]);
     $console->run();
 }
开发者ID:bogdananton,项目名称:selenium-setup,代码行数:24,代码来源:SeleniumSetup.php

示例8: Application

#!/usr/bin/env php
<?php 
/*
 * This file is part of the Certificationy CLI application.
 *
 * (c) Vincent Composieux <vincent.composieux@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require __DIR__ . '/vendor/autoload.php';
use Certificationy\Cli\Command\StartCommand;
use KevinGH\Amend\Command;
use KevinGH\Amend\Helper;
use Symfony\Component\Console\Application;
use Symfony\Component\Yaml\Yaml;
const VERSION = 1.4;
const APPLICATION_NAME = 'Certificationy';
$application = new Application(APPLICATION_NAME, VERSION);
$config = Yaml::parse(file_get_contents('config.yml'));
$updateCommand = new Command('self-update');
$updateCommand->setManifestUri($config['manifest_uri']);
$application->add($updateCommand);
$application->getHelperSet()->set(new Helper());
$startCommand = new StartCommand();
$application->add($startCommand);
$application->setDefaultCommand($startCommand->getName());
$application->run();
开发者ID:ranqiangjun,项目名称:certificationy-cli,代码行数:28,代码来源:certificationy.php

示例9: Application

<?php

require_once __DIR__ . "/../vendor/autoload.php";
use Symfony\Component\Console\Application;
use jamesiarmes\PEWS\Generator\ConvertToPHP;
error_reporting(error_reporting() & ~E_NOTICE);
$cli = new Application('Convert XSD to PHP classes Command Line Interface', "2.0");
$cli->setCatchExceptions(true);
$cli->setDefaultCommand('convert:php');
$cli->addCommands(array(new ConvertToPHP()));
$cli->run();
开发者ID:jchoi926,项目名称:php-ews,代码行数:11,代码来源:generateModels.php

示例10: die

<?php

require __DIR__ . '/vendor/autoload.php';
use SensioLabs\Deptrac\CompilerPass\CollectorPass;
use SensioLabs\Deptrac\CompilerPass\OutputFormatterPass;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Console\Application;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
if (!version_compare(phpversion(), "5.5.9", '>=')) {
    echo 'Required at least PHP version 5.5.9, your version: ' . PHP_VERSION . "\n";
    die(1);
}
(new XmlFileLoader($container = new ContainerBuilder(), new FileLocator(__DIR__)))->load(__DIR__ . '/services.xml');
$container->addCompilerPass(new OutputFormatterPass())->addCompilerPass(new CollectorPass())->compile();
$container->set('container', $container);
$application = new Application();
$application->add($container->get('command_init'));
$application->add($container->get('command_analyze'));
$application->add($container->get('command_self_update'));
$application->setDefaultCommand('analyze');
$application->run();
开发者ID:sensiolabs-de,项目名称:deptrac,代码行数:22,代码来源:deptrac.php

示例11: fwrite

#!/usr/bin/env php
<?php 
if (version_compare(phpversion(), '5.4', '<')) {
    fwrite(STDERR, "PHP needs to be a minimum version of PHP 5.4\n");
    exit(1);
}
Phar::mapPhar('distill-cli.phar');
require_once 'phar://distill-cli.phar/vendor/autoload.php';
use Symfony\Component\Console\Application;
use Distill\Cli\Command as DistillCommand;
$appVersion = '1.0.4';
$app = new Application('Distill CLI', $appVersion);
$app->add(new DistillCommand\ExtractCommand($appVersion));
$app->add(new DistillCommand\AboutCommand($appVersion));
$app->add(new DistillCommand\SelfUpdateCommand($appVersion));
$app->setDefaultCommand('about');
$app->run();
__halt_compiler();
开发者ID:raulfraile,项目名称:distill-cli,代码行数:18,代码来源:phar-stub.php

示例12: Application

 Debug::enable(E_ALL, true);
 $container = \DG\App\loadContainer();
 $eventDispatcher = $container->get('event_dispatcher.traceable');
 $app = new Application();
 $app->add(new MakesCacheCommand($container));
 $app->add(new CssSelectorTestCommand());
 $app->add($reportCommand = new MakesCacheReportCommand());
 $app->add(new DomCrawlerTestCommand());
 $app->add(new DomCrawlerHHTestCommand());
 $app->add(new ExpressionLanguageCommand());
 $app->add(new LockHandlerTestCommand());
 $app->add(new IntlTestCommand());
 $app->add(new ModelsCommand($container));
 $app->add(new ProcessCommand());
 $app->add(new TestTimingAttackCommand());
 $app->setDefaultCommand($reportCommand->getName());
 $app->setDispatcher($eventDispatcher);
 $eventDispatcher->addListener(ConsoleEvents::COMMAND, function (ConsoleCommandEvent $event) use($reportCommand) {
     $output = $event->getOutput();
     $output->writeln("<info>Run command " . $event->getCommand()->getName() . "</info>");
     if ($event->getCommand() instanceof MakesCacheReportCommand) {
         $finder = new Finder();
         $makesCacheFilesCount = $finder->in(CACHE_PATH)->name('makes*.json')->count();
         if ($makesCacheFilesCount === 0 && $event->getCommand()->getName() === $reportCommand->getName()) {
             $output->writeln("<error>There is no cache files. Command execution stopped</error>");
             $event->disableCommand();
         }
     }
 });
 $eventDispatcher->addListener(ConsoleEvents::EXCEPTION, function (ConsoleExceptionEvent $event) {
     //wrap exception
开发者ID:GrizliK1988,项目名称:symfony-certification-prepare-project,代码行数:31,代码来源:console.php

示例13:

#!/usr/bin/php
<?php 
// Require composer autoloader
require_once __DIR__ . '/vendor/autoload.php';
use Symfony\Component\Console;
// Create twitter service
$dataStore = new Ornithology\Service\DataStoreFile(getenv('HOME') . '/.ornithology');
$twitterService = new Ornithology\Service\Twitter($dataStore);
// Initialize the application
$application = new Console\Application('Ornithology', '0.0.3');
// Add application related commands
$application->add(new Ornithology\Command\Quit('exit'));
$application->add(new Ornithology\Command\Mark('mark'));
// Add twitter related commands
$application->add(new Ornithology\Command\Authorize('authorize', $twitterService));
$application->add(new Ornithology\Command\Refresh('refresh', $twitterService));
$application->add(new Ornithology\Command\Tweet('tweet', $twitterService));
$application->add(new Ornithology\Command\Reply('reply', $twitterService));
$application->add(new Ornithology\Command\Retweet('retweet', $twitterService));
$application->add(new Ornithology\Command\Favorite('favorite', $twitterService));
$application->add(new Ornithology\Command\Urls('urls', $twitterService));
// Set some defaults
$application->setDefaultCommand('mark');
// Run the application as a shell
$shell = new Console\Shell($application);
$shell->run();
开发者ID:WouterSioen,项目名称:ornithology,代码行数:26,代码来源:ornithology.php

示例14: Application

<?php

/**
 * Created by Érick Carvalho on 17/12/2015.
 */
require 'vendor/autoload.php';
use Symfony\Component\Console\Application;
use WordFilter\Console\Commands\MainMenuCommand;
use WordFilter\Console\Commands\CorrectorCommand;
use WordFilter\Console\Commands\DictionaryManagerCommand;
$application = new Application('Word Filter', '1.0.1');
$application->add(new DictionaryManagerCommand());
$application->add(new CorrectorCommand());
$application->add(new MainMenuCommand());
$application->setDefaultCommand('menu');
$application->run();
开发者ID:erickmcarvalho,项目名称:word-filter,代码行数:16,代码来源:run.php

示例15: Application

#!/usr/bin/env php
<?php 
require_once './libraries/autoload.php';
use DedicatedManager\Setup\SetupCommand;
use Symfony\Component\Console\Application;
error_reporting(E_ALL & ~E_DEPRECATED & ~E_WARNING);
$application = new Application();
$application->add(new SetupCommand());
$application->setDefaultCommand('setup');
$application->run();
开发者ID:maniaplanet,项目名称:dedicated-manager,代码行数:10,代码来源:setup.php


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