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


PHP Application::run方法代码示例

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


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

示例1: execute

 /**
  * {@inheritdoc}
  */
 public function execute(ContainerInterface $app)
 {
     foreach ($this->commands as $command) {
         $this->console->add($app->create($command));
     }
     $this->console->run();
 }
开发者ID:Festiv,项目名称:Festiv,代码行数:10,代码来源:ConsoleKernel.php

示例2: start

 protected function start()
 {
     $this->console = new SymfonyApplication(self::APP_NAME, self::VERSION);
     foreach ($this->commands as $command) {
         $this->console->add($command);
     }
     $this->console->run();
 }
开发者ID:titaphp,项目名称:framework,代码行数:8,代码来源:Application.php

示例3: run

 /**
  * @throws \Exception
  */
 public function run()
 {
     $commands = $this->config('commands');
     foreach ($commands as $command) {
         $this->console->add($this->container->get($command));
     }
     $this->console->run();
 }
开发者ID:dafiti,项目名称:kong-cli,代码行数:11,代码来源:Application.php

示例4: run

 /**
  * @param string $input
  *
  * @return integer
  */
 public function run($input)
 {
     $this->input = new StringInput($input);
     $this->output = new StreamOutput(fopen('php://memory', 'w', false));
     $inputStream = $this->getInputStream();
     rewind($inputStream);
     $this->application->getHelperSet()->get('dialog')->setInputStream($inputStream);
     $this->result = $this->application->run($this->input, $this->output);
 }
开发者ID:coduo,项目名称:phpspec-matcher-extension,代码行数:14,代码来源:ApplicationTester.php

示例5: cliAction

 /**
  * Index action - runs the console application
  */
 public function cliAction()
 {
     $exitCode = $this->cliApplication->run(new RequestInput($this->getRequest()));
     if (is_numeric($exitCode)) {
         $model = class_exists(ViewModel::class) ? new ViewModel() : new V2ViewModel();
         $model->setErrorLevel($exitCode);
         return $model;
     }
 }
开发者ID:TomHAnderson,项目名称:DoctrineModule,代码行数:12,代码来源:CliController.php

示例6: runAction

 /**
  * 
  * @return ConsoleModel
  */
 public function runAction()
 {
     $exitCode = $this->application->run(new RequestInput($this->getRequest()));
     if (is_numeric($exitCode)) {
         $model = new ConsoleModel();
         $model->setErrorLevel($exitCode);
         return $model;
     }
 }
开发者ID:alex-oleshkevich,项目名称:zf-extras,代码行数:13,代码来源:ConsoleController.php

示例7: run

 public function run()
 {
     if ($this->container->getConfig()->get('app.debug')) {
         foreach ($this->app->all() as $commandKey => $command) {
             if (method_exists($command, 'isVagrant') && $command->isVagrant()) {
                 $this->toggleVagrantCommand($commandKey, $command);
             }
         }
     }
     $this->app->run();
 }
开发者ID:sinergi,项目名称:core,代码行数:11,代码来源:CommandRuntime.php

示例8: execute

 /**
  * Main function of Facilior
  * @return int
  */
 public function execute()
 {
     //Greetings
     $this->console->log('Logging started');
     $this->console->output('<fg=default;options=bold>Logging started:</> <fg=magenta>' . $this->console->getLogFile() . '</>', 0, 2);
     $fileService = new FileService();
     $fileService->init();
     //Run Command and check if there is a config error
     $exitCode = $this->application->run();
     $fileService->cleanup();
     return $exitCode;
 }
开发者ID:lotzer,项目名称:facilior,代码行数:16,代码来源:Console.php

示例9: runCommand

 /**
  * {@inheritdoc}
  */
 public function runCommand($command, $params = [])
 {
     $params = array_merge(['command' => $command], $params, $this->getDefaultParams());
     $this->application->setAutoExit(false);
     $exitCode = $this->application->run(new ArrayInput($params), $this->output);
     if (0 !== $exitCode) {
         $this->application->setAutoExit(true);
         $errorMessage = sprintf('The command terminated with an error code: %u.', $exitCode);
         $this->output->writeln("<error>{$errorMessage}</error>");
         $e = new \Exception($errorMessage, $exitCode);
         throw $e;
     }
     return $this;
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:17,代码来源:CommandExecutor.php

示例10: runCommand

 /**
  * @param $command
  * @param array $parameters
  * @param OutputInterface $output
  *
  * @return $this
  *
  * @throws \Exception
  */
 public function runCommand($command, $parameters = array(), OutputInterface $output = null)
 {
     $parameters = array_merge(array('command' => $command), $this->getDefaultParameters(), $parameters);
     $this->application->setAutoExit(false);
     $exitCode = $this->application->run(new ArrayInput($parameters), $output ?: new NullOutput());
     if (0 !== $exitCode) {
         $this->application->setAutoExit(true);
         $errorMessage = sprintf('The command terminated with an error code: %u.', $exitCode);
         $this->output->writeln("<error>{$errorMessage}</error>");
         $exception = new \Exception($errorMessage, $exitCode);
         throw $exception;
     }
     return $this;
 }
开发者ID:Strontium-90,项目名称:Sylius,代码行数:23,代码来源:CommandExecutor.php

示例11: testCommand

 public function testCommand()
 {
     $app = new Application('Propel', Propel::VERSION);
     $command = new DatabaseReverseCommand();
     $app->add($command);
     $currentDir = getcwd();
     $outputDir = __DIR__ . '/../../../../reversecommand';
     chdir(__DIR__ . '/../../../../Fixtures/bookstore');
     $input = new \Symfony\Component\Console\Input\ArrayInput(array('command' => 'database:reverse', '--database-name' => 'reverse-test', '--output-dir' => $outputDir, '--verbose' => true, '--platform' => ucfirst($this->getDriver()) . 'Platform', 'connection' => $this->getConnectionDsn('bookstore-schemas', true)));
     $output = new \Symfony\Component\Console\Output\StreamOutput(fopen("php://temp", 'r+'));
     $app->setAutoExit(false);
     $result = $app->run($input, $output);
     chdir($currentDir);
     if (0 !== $result) {
         rewind($output->getStream());
         echo stream_get_contents($output->getStream());
     }
     $this->assertEquals(0, $result, 'database:reverse tests exited successfully');
     $databaseXml = simplexml_load_file($outputDir . '/schema.xml');
     $this->assertEquals('reverse-test', $databaseXml['name']);
     $this->assertGreaterThan(20, $databaseXml->xpath("table"));
     $table = $databaseXml->xpath("table[@name='acct_access_role']");
     $this->assertCount(1, $table);
     $table = $table[0];
     $this->assertEquals('acct_access_role', $table['name']);
     $this->assertEquals('AcctAccessRole', $table['phpName']);
     $this->assertCount(2, $table->xpath('column'));
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:28,代码来源:DatabaseReverseTest.php

示例12: run

 /**
  * {@inheritDoc}
  */
 public function run(InputInterface $input = null, OutputInterface $output = null)
 {
     if (null === $output) {
         $output = Factory::createOutput();
     }
     return parent::run($input, $output);
 }
开发者ID:detain,项目名称:composer,代码行数:10,代码来源:Application.php

示例13: run

 public function run(InputInterface $input = null, OutputInterface $output = null)
 {
     $fp = fopen($this->config['lockfile'], "w");
     // if you run this script as root - change user/group
     if (file_exists($this->config['lockfile'])) {
         chown($this->config['lockfile'], $this->config['file-user']);
         chgrp($this->config['lockfile'], $this->config['file-group']);
     }
     $exitCode = 0;
     if (flock($fp, LOCK_EX | LOCK_NB)) {
         // acquire an exclusive lock
         ftruncate($fp, 0);
         $exitCode = parent::run($input, $output);
         fflush($fp);
         // flush output before releasing the lock
         flock($fp, LOCK_UN);
         // release the lock
     } else {
         //throw new DNSSyncException("Running multiple instances is not allowed."); - nezachytí applikace error
         //$output->writeln() - null v této chvíli
         $message = "Running multiple instances is not allowed.";
         echo $message . PHP_EOL;
         mail($this->config['admin-email'], $message, $message);
         $exitCode = 500;
     }
     fclose($fp);
     return $exitCode;
 }
开发者ID:heximcz,项目名称:synknot,代码行数:28,代码来源:DNSSyncApplication.php

示例14: run

 /**
  * Inicializa a aplicação.
  *
  * @throws \Exception
  */
 public function run()
 {
     //apenas para inicializar
     Config::getInstance();
     $application = new Application();
     $commands = [];
     /* Carregando os comandos internos */
     $anna_commands = __DIR__ . DS . 'Commands' . DS;
     $anna_commands = $this->loadAppCommands($anna_commands);
     /* Carregandos os comandos criados pelos desenvolvedores */
     $app_commands = SYS_ROOT . 'App' . DS . 'Console' . DS;
     $app_commands = $this->loadAppCommands($app_commands);
     /* Registra todos os comandos encontrados */
     foreach ($app_commands as $cmd) {
         $commands[] = new $cmd();
     }
     foreach ($anna_commands as $cmd) {
         $class = new \ReflectionClass($cmd);
         if (!$class->isAbstract()) {
             $commands[] = new $cmd();
         }
     }
     $application->addCommands($commands);
     $application->run();
 }
开发者ID:anna-framework,项目名称:anna,代码行数:30,代码来源:Initializer.php

示例15: run

 /**
  * @param InputInterface|null $input
  * @param OutputInterface|null $output
  * @return int
  * @throws \Exception
  */
 public function run(InputInterface $input = null, OutputInterface $output = null)
 {
     foreach ($this->factory->createCommands() as $command) {
         $this->add($command);
     }
     return parent::run($input, $this->factory->createOutput());
 }
开发者ID:TYPO3,项目名称:Surf,代码行数:13,代码来源:ConsoleApplication.php


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