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


PHP ArrayInput::setInteractive方法代码示例

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


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

示例1: testShouldNotClearScreenInNotInteractiveMode

 public function testShouldNotClearScreenInNotInteractiveMode()
 {
     $SUT = $this->createSUT();
     $this->input->setInteractive(false);
     $SUT->cls();
     $this->assertEquals('', $this->output->fetch());
 }
开发者ID:shobcheye,项目名称:sw-cli-tools,代码行数:7,代码来源:IoServiceTest.php

示例2: doRun

 /**
  * Runs the current application.
  *
  * @param InputInterface  $input  An Input instance
  * @param OutputInterface $output An Output instance
  *
  * @return integer 0 if everything went fine, or an error code
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     $output->writeLn($this->getHeader());
     $name = $this->getCommandName($input);
     if (true === $input->hasParameterOption(array('--shell', '-s'))) {
         $shell = new Shell($this);
         $shell->run();
         return 0;
     }
     if (true === $input->hasParameterOption(array('--ansi'))) {
         $output->setDecorated(true);
     } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
         $output->setDecorated(false);
     }
     if (true === $input->hasParameterOption(array('--help', '-h'))) {
         if (!$name) {
             $name = 'help';
             $input = new ArrayInput(array('command' => 'help'));
         } else {
             $this->wantHelps = true;
         }
     }
     if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
         $input->setInteractive(false);
     }
     if (function_exists('posix_isatty') && $this->getHelperSet()->has('dialog')) {
         $inputStream = $this->getHelperSet()->get('dialog')->getInputStream();
         if (!posix_isatty($inputStream)) {
             $input->setInteractive(false);
         }
     }
     if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
         $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
     } elseif (true === $input->hasParameterOption(array('--verbose', '-v'))) {
         $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
     }
     if (true === $input->hasParameterOption(array('--version', '-V'))) {
         $output->writeln($this->getLongVersion());
         return 0;
     }
     if (!$name) {
         $name = 'list';
         $input = new ArrayInput(array('command' => 'list'));
     }
     // the command name MUST be the first element of the input
     $command = $this->find($name);
     $this->runningCommand = $command;
     $statusCode = $command->run($input, $output);
     $this->runningCommand = null;
     # write Footer
     $output->writeLn($this->getFooter());
     return is_numeric($statusCode) ? $statusCode : 0;
 }
开发者ID:icomefromthenet,项目名称:faker,代码行数:61,代码来源:Application.php

示例3: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ($this->isEnabled()) {
         $bundleName = $input->getArgument("bundle");
         $bundle = $this->getContainer()->get('kernel')->getBundle($bundleName);
         /* @var $bundle BundleInterface */
         $entities = array();
         foreach ($this->getBundleMetadata($bundle) as $m) {
             /* @var $m ClassMetadata */
             $_tmp = explode('\\', $m->getName());
             $entityName = array_pop($_tmp);
             $entities[$bundleName . ':' . $entityName] = $entityName;
         }
         $command = $this->getApplication()->find('itscaro:generate:crud');
         foreach ($entities as $entityShortcut => $entityName) {
             try {
                 $_input = new ArrayInput(['command' => 'itscaro:generate:crud', '--entity' => $entityShortcut, '--route-prefix' => $input->getOption('route-prefix') . strtolower($entityName), '--with-write' => $input->getOption('with-write'), '--format' => $input->getOption('format'), '--overwrite' => $input->getOption('overwrite')]);
                 $_input->setInteractive($input->isInteractive());
                 $output->writeln("<info>Executing:</info> {$_input}");
                 $returnCode = $command->run($_input, $output);
                 $output->writeln("\t<info>Done</info>");
             } catch (\Exception $e) {
                 $output->writeln("\t<error>Error:</error> " . $e->getMessage());
             }
         }
     } else {
         $output->writeln('<error>Cannot find DoctrineBundle</error>');
     }
 }
开发者ID:itscaro,项目名称:crud-generator-bundle,代码行数:29,代码来源:CrudAllCommand.php

示例4: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $dialog = $this->getHelperSet()->get('dialog');
     $command = $this->getApplication()->find('translations:fetch');
     $arguments = array('command' => 'translations:fetch', '--username' => $input->getOption('username'), '--password' => $input->getOption('password'), '--keep-english' => true);
     $inputObject = new ArrayInput($arguments);
     $inputObject->setInteractive($input->isInteractive());
     $command->run($inputObject, $output);
     $englishFromOTrance = FetchFromOTrance::getDownloadPath() . DIRECTORY_SEPARATOR . 'en.json';
     if (!file_exists($englishFromOTrance)) {
         $output->writeln("English file from oTrance missing. Aborting");
         return;
     }
     $englishFromOTrance = json_decode(file_get_contents($englishFromOTrance), true);
     Translate::reloadLanguage('en');
     $availableTranslations = $GLOBALS['Piwik_translations'];
     $categories = array_unique(array_merge(array_keys($englishFromOTrance), array_keys($availableTranslations)));
     sort($categories);
     $unnecessary = $outdated = $missing = array();
     foreach ($categories as $category) {
         if (!empty($englishFromOTrance[$category])) {
             foreach ($englishFromOTrance[$category] as $key => $value) {
                 if (!array_key_exists($category, $availableTranslations) || !array_key_exists($key, $availableTranslations[$category])) {
                     $unnecessary[] = sprintf('%s_%s', $category, $key);
                     continue;
                 } else {
                     if (html_entity_decode($availableTranslations[$category][$key]) != html_entity_decode($englishFromOTrance[$category][$key])) {
                         $outdated[] = sprintf('%s_%s', $category, $key);
                         continue;
                     }
                 }
             }
         }
         if (!empty($availableTranslations[$category])) {
             foreach ($availableTranslations[$category] as $key => $value) {
                 if (!array_key_exists($category, $englishFromOTrance) || !array_key_exists($key, $englishFromOTrance[$category])) {
                     $missing[] = sprintf('%s_%s', $category, $key);
                     continue;
                 }
             }
         }
     }
     $output->writeln("");
     if (!empty($missing)) {
         $output->writeln("<bg=yellow;options=bold>-- Following keys are missing on oTrance --</bg=yellow;options=bold>");
         $output->writeln(implode("\n", $missing));
         $output->writeln("");
     }
     if (!empty($unnecessary)) {
         $output->writeln("<bg=yellow;options=bold>-- Following keys might be unnecessary on oTrance --</bg=yellow;options=bold>");
         $output->writeln(implode("\n", $unnecessary));
         $output->writeln("");
     }
     if (!empty($outdated)) {
         $output->writeln("<bg=yellow;options=bold>-- Following keys are outdated on oTrance --</bg=yellow;options=bold>");
         $output->writeln(implode("\n", $outdated));
         $output->writeln("");
     }
     $output->writeln("Finished.");
 }
开发者ID:kreynen,项目名称:elmsln,代码行数:60,代码来源:CompareKeys.php

示例5: handleMigrations

 /**
  * Run doctrine migrations
  */
 protected function handleMigrations()
 {
     $application = $this->getApplication();
     $commandInput = new ArrayInput(array('command' => 'doctrine:migrations:migrate'));
     $commandInput->setInteractive(false);
     $application->doRun($commandInput, $this->output);
 }
开发者ID:BenoitLeveque,项目名称:PrestaDeploymentBundle,代码行数:10,代码来源:UpdateCommand.php

示例6: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $file = 'build/portable-zip-api.zip';
     $pharCommand = $this->getApplication()->find('build:phar');
     $arrayInput = new ArrayInput(array('command' => 'build:phar'));
     $arrayInput->setInteractive(false);
     if ($pharCommand->run($arrayInput, $output)) {
         $output->writeln('The operation is aborted due to build:phar command');
         return 1;
     }
     if (file_exists($file)) {
         $output->writeln('Removing previous package');
         unlink($file);
     }
     $zip = new \ZipArchive();
     if ($zip->open($file, \ZipArchive::CREATE) !== true) {
         $output->writeln('Failed to open zip archive');
         return 1;
     }
     $zip->addFile('build/zip.phar.php', 'zip.phar.php');
     $zip->addFile('app/zip.sqlite.db', 'zip.sqlite.db');
     $zip->addFile('README.md', 'README.md');
     $zip->close();
     return 0;
 }
开发者ID:kzykhys,项目名称:portable-zipcode-api,代码行数:28,代码来源:PackageCommand.php

示例7: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $force = (bool) $input->getOption('force');
     $dialog = $this->getHelperSet()->get('dialog');
     // Doctrine create database
     if ($force || $dialog->askConfirmation($output, '<question>Create Database?</question>', false)) {
         $output->writeln('Creating database...');
         $command = $this->getApplication()->find('doctrine:database:create');
         $input = new ArrayInput(['command' => 'doctrine:database:create', '-n' => $force]);
         $returnCode = $command->run($input, $output);
     }
     // Doctrine schema update
     if ($force || $dialog->askConfirmation($output, '<question>Load Schema?</question>', false)) {
         $output->writeln('Loading Schema...');
         $command = $this->getApplication()->find('doctrine:schema:update');
         $input = new ArrayInput(['command' => 'doctrine:schema:update', '--force' => true, '-n' => $force]);
         $returnCode = $command->run($input, $output);
     }
     // Doctrine Fixtures
     if ($force || $dialog->askConfirmation($output, '<question>Load Fixtures?</question>', false)) {
         $output->writeln('Loading Fixtures...');
         $command = $this->getApplication()->find('doctrine:fixtures:load');
         $input = new ArrayInput(['doctrine:fixtures:load']);
         $input->setInteractive(!$force);
         $returnCode = $command->run($input, $output);
     }
     $output->writeln('Finished.');
 }
开发者ID:symedit,项目名称:symedit,代码行数:28,代码来源:InstallCommand.php

示例8: prepareInput

 /**
  * Prepare the input interface for the command.
  *
  * @return InputInterface
  */
 protected function prepareInput()
 {
     $arguments = ['--optimize' => (bool) $this->file->get(self::SETTING_OPTIMIZE), '--no-dev' => true];
     $input = new ArrayInput($arguments);
     $input->setInteractive(false);
     return $input;
 }
开发者ID:tenside,项目名称:core,代码行数:12,代码来源:DumpAutoloadTask.php

示例9: testBuildCommands

 public function testBuildCommands()
 {
     $definition = new CommandDefinition('self-update');
     $definition->setDescription('Update spress.phar to the latest version.');
     $definition->setHelp('The self-update command replace your spress.phar by the latest version.');
     $definition->addOption('all');
     $definition->addArgument('dir');
     $input = new ArrayInput([]);
     $input->setInteractive(false);
     $output = new StreamOutput(fopen('php://memory', 'w', false));
     $commandPluginMock = $this->getMockBuilder('\\Yosymfony\\Spress\\Plugin\\CommandPlugin')->getMock();
     $commandPluginMock->expects($this->once())->method('getCommandDefinition')->will($this->returnValue($definition));
     $commandPluginMock->expects($this->once())->method('executeCommand');
     $pm = new PluginManager(new EventDispatcher());
     $pm->getPluginCollection()->add('emptyCommandPlugin', $commandPluginMock);
     $builder = new ConsoleCommandBuilder($pm);
     $symfonyConsoleCommands = $builder->buildCommands();
     $this->assertTrue(is_array($symfonyConsoleCommands));
     $this->assertCount(1, $symfonyConsoleCommands);
     $this->assertContainsOnlyInstancesOf('Symfony\\Component\\Console\\Command\\Command', $symfonyConsoleCommands);
     $symfonyConsoleCommand = $symfonyConsoleCommands[0];
     $this->assertCount(1, $symfonyConsoleCommand->getDefinition()->getOptions());
     $this->assertCount(1, $symfonyConsoleCommand->getDefinition()->getArguments());
     $this->assertEquals('Update spress.phar to the latest version.', $symfonyConsoleCommand->getDescription());
     $this->assertEquals('The self-update command replace your spress.phar by the latest version.', $symfonyConsoleCommand->getHelp());
     $symfonyConsoleCommand->run($input, $output);
 }
开发者ID:spress,项目名称:spress,代码行数:27,代码来源:ConsoleCommandBuilderTest.php

示例10: callCommands

 /**
  * @param ConsoleTerminateEvent $event
  */
 public function callCommands(ConsoleTerminateEvent $event)
 {
     /**
      * @var \Drupal\Console\Command\Command $command
      */
     $command = $event->getCommand();
     $output = $event->getOutput();
     if (!$command instanceof Command) {
         return;
     }
     $application = $command->getApplication();
     $commands = $application->getChain()->getCommands();
     if (!$commands) {
         return;
     }
     foreach ($commands as $chainedCommand) {
         if ($chainedCommand['name'] == 'module:install') {
             $messageHelper = $application->getMessageHelper();
             $translatorHelper = $application->getTranslator();
             $messageHelper->addErrorMessage($translatorHelper->trans('commands.chain.messages.module_install'));
             continue;
         }
         $callCommand = $application->find($chainedCommand['name']);
         $input = new ArrayInput($chainedCommand['inputs']);
         if (!is_null($chainedCommand['interactive'])) {
             $input->setInteractive($chainedCommand['interactive']);
         }
         $callCommand->run($input, $output);
     }
 }
开发者ID:rmelike,项目名称:DrupalConsole,代码行数:33,代码来源:CallCommandListener.php

示例11: executeCommand

 private function executeCommand($command, $arguments, OutputInterface $output)
 {
     $command = $this->getApplication()->find($command);
     $arguments['command'] = $command;
     $input = new ArrayInput($arguments);
     $input->setInteractive(false);
     return $command->run($input, $output);
 }
开发者ID:proyecto404,项目名称:UtilBundle,代码行数:8,代码来源:GenerateDatabaseCommand.php

示例12: launchImportCommand

 protected function launchImportCommand()
 {
     $app = new Application(self::$container->get('kernel'));
     $app->setAutoExit(false);
     $input = new ArrayInput(array('command' => 'modera:translations:import'));
     $input->setInteractive(false);
     $exitCode = $app->run($input, new NullOutput());
     $this->assertEquals(0, $exitCode);
 }
开发者ID:modera,项目名称:foundation,代码行数:9,代码来源:AbstractFunctionalTestCase.php

示例13: launchCommand

 /**
  * @param null|string|array $config
  */
 private function launchCommand($config = null)
 {
     $app = new Application(self::$kernel->getContainer()->get('kernel'));
     $app->setAutoExit(false);
     $input = new ArrayInput(array('command' => 'modera:languages:config-sync-dummy', 'config' => $config ? json_encode($config) : null));
     $input->setInteractive(false);
     $result = $app->run($input, new NullOutput());
     $this->assertEquals(0, $result);
 }
开发者ID:modera,项目名称:foundation,代码行数:12,代码来源:SyncLanguagesCommandTest.php

示例14: executeCommand

function executeCommand($application, $command, array $options = array())
{
    $options["--env"] = "test";
    $options["--quiet"] = true;
    $options = array_merge($options, array('command' => $command));
    $arrayInput = new ArrayInput($options);
    $arrayInput->setInteractive(false);
    $application->run($arrayInput);
}
开发者ID:vegardbb,项目名称:webpage,代码行数:9,代码来源:testBootstrap.php

示例15: update

 public function update($name)
 {
     $app = new Application();
     $app->setAutoExit(false);
     $input = new ArrayInput(['update', 'packages' => [$name]]);
     $input->setInteractive(false);
     $output = new BufferedOutput();
     $app->run($input, $output);
     return $output->fetch();
 }
开发者ID:mathielen,项目名称:package-manager,代码行数:10,代码来源:PackageInstaller.php


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