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


PHP SymfonyStyle::text方法代码示例

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


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

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $show_installed = !$input->getOption('available');
     $installed = $available = array();
     foreach ($this->load_migrations() as $name) {
         if ($this->migrator->migration_state($name) !== false) {
             $installed[] = $name;
         } else {
             $available[] = $name;
         }
     }
     if ($show_installed) {
         $io->section($this->user->lang('CLI_MIGRATIONS_INSTALLED'));
         if (!empty($installed)) {
             $io->listing($installed);
         } else {
             $io->text($this->user->lang('CLI_MIGRATIONS_EMPTY'));
             $io->newLine();
         }
     }
     $io->section($this->user->lang('CLI_MIGRATIONS_AVAILABLE'));
     if (!empty($available)) {
         $io->listing($available);
     } else {
         $io->text($this->user->lang('CLI_MIGRATIONS_EMPTY'));
         $io->newLine();
     }
 }
开发者ID:phpbb,项目名称:phpbb,代码行数:29,代码来源:list_command.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // throw new \Exception('boo');
     $directory = realpath($input->getArgument('directory'));
     $directoryOutput = $input->getArgument('outputdirectory');
     /* @var $logger Psr\Log\LoggerInterface */
     $this->logger = $this->getContainer()->get('logger');
     $io = new SymfonyStyle($input, $output);
     $io->title('DDD Model Generation');
     $clean = $input->hasOption('clean');
     if ($clean) {
         $io->section('Clean output directoty');
         $fs = new \Symfony\Component\Filesystem\Filesystem();
         try {
             $fs->remove($directoryOutput);
         } catch (IOExceptionInterface $e) {
             $io->error($e->getMessage());
         }
         $io->text('clean of ' . $directoryOutput . ' completed');
     }
     if (is_dir($directory)) {
         $finder = new Finder();
         $finder->search($directory);
         foreach ($finder->getFindedFiles() as $file) {
             if (pathinfo($file, PATHINFO_FILENAME) == 'model.yml') {
                 $io->text('Analizzo model.yml in ' . pathinfo($file, PATHINFO_DIRNAME));
                 $dddGenerator = new DDDGenerator();
                 $dddGenerator->setLogger($this->logger);
                 $dddGenerator->analyze($file);
                 $dddGenerator->generate($directoryOutput);
             }
         }
         $io->section('Php-Cs-Fixer on generated files');
         $fixer = new \Symfony\CS\Console\Command\FixCommand();
         $input = new ArrayInput(['path' => $directoryOutput, '--level' => 'psr2', '--fixers' => 'eof_ending,strict_param,short_array_syntax,trailing_spaces,indentation,line_after_namespace,php_closing_tag']);
         $output = new BufferedOutput();
         $fixer->run($input, $output);
         $content = $output->fetch();
         $io->text($content);
         if (count($this->errors) == 0) {
             $io->success('Completed generation');
         } else {
             $io->error($this->errors);
         }
     } else {
         $io->caution('Directory ' . $directory . ' not valid');
     }
     // PER I WARNING RECUPERABILI
     //$io->note('Generate Class');
 }
开发者ID:yoghi,项目名称:madda,代码行数:50,代码来源:GenerateModelCommand.php

示例3: execute

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io->title($this->getDescription());
     $this->io->text("removing articles\n");
     $this->removeArticles();
     $this->io->newLine(2);
     $this->io->text("refresh journal and remove issues\n");
     $this->removeIssues($input);
     $this->io->newLine(1);
     $this->io->text("refresh journal and remove journal totally");
     $this->refreshJournal($input);
     $this->em->remove($this->journal);
     $this->em->flush();
     $this->io->success('successfully removed journal');
 }
开发者ID:ojs,项目名称:ojs,代码行数:20,代码来源:DeleteJournalCommand.php

示例4: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $router = $this->getContainer()->get('router');
     $context = $router->getContext();
     if (null !== ($method = $input->getOption('method'))) {
         $context->setMethod($method);
     }
     if (null !== ($scheme = $input->getOption('scheme'))) {
         $context->setScheme($scheme);
     }
     if (null !== ($host = $input->getOption('host'))) {
         $context->setHost($host);
     }
     $matcher = new TraceableUrlMatcher($router->getRouteCollection(), $context);
     $traces = $matcher->getTraces($input->getArgument('path_info'));
     $io->newLine();
     $matches = false;
     foreach ($traces as $trace) {
         if (TraceableUrlMatcher::ROUTE_ALMOST_MATCHES == $trace['level']) {
             $io->text(sprintf('Route <info>"%s"</> almost matches but %s', $trace['name'], lcfirst($trace['log'])));
         } elseif (TraceableUrlMatcher::ROUTE_MATCHES == $trace['level']) {
             $io->success(sprintf('Route "%s" matches', $trace['name']));
             $routerDebugCommand = $this->getApplication()->find('debug:router');
             $routerDebugCommand->run(new ArrayInput(array('name' => $trace['name'])), $output);
             $matches = true;
         } elseif ($input->getOption('verbose')) {
             $io->text(sprintf('Route "%s" does not match: %s', $trace['name'], $trace['log']));
         }
     }
     if (!$matches) {
         $io->error(sprintf('None of the routes match the path "%s"', $input->getArgument('path_info')));
         return 1;
     }
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:38,代码来源:RouterMatchCommand.php

示例5: updateModules

 private function updateModules()
 {
     $this->output->text('Attempting to updating modules');
     /** @var EntityManager|DocumentManager $manager */
     $manager = $this->getContainer()->get('default_manager');
     $repo = $manager->getRepository('App:Module');
     foreach ($this->getContainer()->getParameter('kernel.modules') as $module) {
         if (empty($repo->findOneBy(['name' => $module::getModuleName()]))) {
             $this->output->text('New module discovered. Adding to database.');
             $this->addModule($module);
         }
     }
     /** @var Module[] $modules */
     $modules = $manager->getRepository('App:Module')->findAll();
     /** @var Server[] $servers */
     $servers = $manager->getRepository($this->getContainer()->getParameter('server_class'))->findAll();
     foreach ($servers as $server) {
         foreach ($modules as $module) {
             if (!$server->hasModule($module)) {
                 $serverModule = new ServerModule();
                 $serverModule->setModule($module);
                 $serverModule->setServer($server);
                 $serverModule->setEnabled($module->getDefaultEnabled());
                 $manager->persist($serverModule);
                 $server->addModule($serverModule);
                 $manager->persist($server);
             }
         }
     }
     $manager->flush();
 }
开发者ID:lfgamers,项目名称:discord-base-bot,代码行数:31,代码来源:RunCommand.php

示例6: addInitializePhp

    /**
     * Adds the initialize.php file.
     */
    private function addInitializePhp()
    {
        $this->fs->dumpFile($this->rootDir . '/system/initialize.php', <<<'EOF'
<?php

use Contao\CoreBundle\Response\InitializeControllerResponse;
use Symfony\Component\HttpFoundation\Request;

if (!defined('TL_SCRIPT')) {
    die('Your script is not compatible with Contao 4.');
}

/**
 * @var Composer\Autoload\ClassLoader
 */
$loader = require __DIR__ . '/../app/autoload.php';
include_once __DIR__ . '/../app/bootstrap.php.cache';

$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();

$response = $kernel->handle(Request::create('/_contao/initialize', 'GET', [], [], [], $_SERVER));

// Send the response if not generated by the InitializeController
if (!($response instanceof InitializeControllerResponse)) {
    $response->send();
    $kernel->terminate($request, $response);
    exit;
}

EOF
);
        $this->io->text("Added/updated the <comment>system/initialize.php</comment> file.\n");
    }
开发者ID:qzminski,项目名称:contao-core-bundle,代码行数:37,代码来源:InstallCommand.php

示例7: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $io->title('Exporting databases');
     $io->section('Exporting all databases');
     $strategies = $this->collectorDbStrategy->collectDatabasesStrategies();
     $totalStrategies = count($strategies);
     $io->writeln($totalStrategies . ' strategie(s) found.');
     $progressBar = new ProgressBar($output, $totalStrategies);
     $progressBar->setFormat(self::PROGRESS_BAR_FORMAT);
     $progressBar->setMessage('Beginning backuping');
     $this->eventDispatcher->dispatch(Events::BACKUP_BEGINS, new BackupBeginsEvent($output));
     $progressBar->start();
     $reportContent = new \ArrayObject();
     foreach ($strategies as $strategy) {
         $strategyIdentifier = $strategy->getIdentifier();
         $setProgressBarMessage = function ($message) use($progressBar, $strategyIdentifier) {
             $message = "[{$strategyIdentifier}] {$message}";
             $progressBar->setMessage($message);
             $progressBar->display();
         };
         $exportedFiles = $this->processorDatabaseDumper->dump($strategy, $setProgressBarMessage);
         $reportContent->append("Backuping of the database: {$strategyIdentifier}");
         foreach ($exportedFiles as $file) {
             $filename = $file->getPath();
             $reportContent->append("\t→ {$filename}");
         }
         $progressBar->advance();
     }
     $progressBar->finish();
     $io->newLine(2);
     $io->section('Report');
     $io->text($reportContent->getArrayCopy());
     $this->eventDispatcher->dispatch(Events::BACKUP_ENDS, new BackupEndsEvent($output));
 }
开发者ID:Viscaweb,项目名称:EasyBackups,代码行数:35,代码来源:DatabaseDumperCommand.php

示例8: execute

 public function execute(SymfonyStyle $io = null)
 {
     $currentProfiles = $this->em->getRepository('CampaignChainLocationGoogleAnalyticsBundle:Profile')->findAll();
     if (empty($currentProfiles)) {
         $io->text('There is no Profile entity to update');
         return true;
     }
     foreach ($currentProfiles as $profile) {
         if (substr($profile->getProfileId(), 0, 2) != 'UA') {
             continue;
         }
         $profile->setPropertyId($profile->getProfileId());
         $gaProfileUrl = $profile->getLocation()->getUrl();
         $google_base_url = 'https:\\/\\/www.google.com\\/analytics\\/web\\/#report\\/visitors-overview\\/a' . $profile->getAccountId() . 'w\\d+p';
         $pattern = '/' . $google_base_url . '(.*)/';
         preg_match($pattern, $gaProfileUrl, $matches);
         if (!empty($matches) && count($matches) == 2) {
             $profile->setProfileId($matches[1]);
             $profile->setIdentifier($profile->getProfileId());
         }
         $this->em->persist($profile);
     }
     $this->em->flush();
     return true;
 }
开发者ID:campaignchain,项目名称:report-google-analytics,代码行数:25,代码来源:UpdateGoogleProfileEntities.php

示例9: updateCode

 /**
  * @param SymfonyStyle|null $io
  */
 public function updateCode(SymfonyStyle $io = null)
 {
     $io->title('CampaignChain Data Update');
     if (empty($this->versions)) {
         $io->warning('No code updater Service found, maybe you didn\'t enable a bundle?');
         return;
     }
     $io->comment('The following data versions will be updated');
     $migratedVersions = array_map(function (DataUpdateVersion $version) {
         return $version->getVersion();
     }, $this->em->getRepository('CampaignChainUpdateBundle:DataUpdateVersion')->findAll());
     $updated = false;
     foreach ($this->versions as $version => $class) {
         if (in_array($version, $migratedVersions)) {
             continue;
         }
         $io->section('Version ' . $class->getVersion());
         $io->listing($class->getDescription());
         $io->text('Begin data update');
         $result = $class->execute($io);
         if ($result) {
             $dbVersion = new DataUpdateVersion();
             $dbVersion->setVersion($version);
             $this->em->persist($dbVersion);
             $this->em->flush();
             $io->text('Data update finished');
         }
         $updated = true;
     }
     if (!$updated) {
         $io->success('All data is up to date.');
     } else {
         $io->success('Every data version has been updated.');
     }
 }
开发者ID:campaignchain,项目名称:update,代码行数:38,代码来源:DataUpdateService.php

示例10: outputAppliedHandler

 /**
  * Outputs the handler that has been applied (resolved), but
  * only if the given handler is not the same as the last
  * handler.
  *
  * @param \Aedart\Scaffold\Contracts\Handlers\Handler $handler
  */
 protected function outputAppliedHandler($handler)
 {
     $handlerClass = get_class($handler);
     if ($handlerClass != $this->lastHandler) {
         $this->lastHandler = $handlerClass;
         $this->output->text("Using handler: {$handlerClass}");
     }
 }
开发者ID:aedart,项目名称:scaffold,代码行数:15,代码来源:BaseTask.php

示例11: normalizeLastIssuesByJournal

 /**
  * @param Journal $journal
  * @return bool|null
  */
 private function normalizeLastIssuesByJournal(Journal $journal)
 {
     $this->io->newLine();
     $this->io->text('normalizing last issue for ' . $journal->getTitle());
     $this->io->progressAdvance();
     $findLastIssue = $this->em->getRepository('OjsJournalBundle:Issue')->findOneBy(['journal' => $journal, 'lastIssue' => true]);
     if ($findLastIssue) {
         return true;
     }
     /** @var Issue|null $getLogicalLastIssue */
     $getLogicalLastIssue = $this->em->getRepository('OjsJournalBundle:Issue')->getLastIssueByJournal($journal);
     if ($getLogicalLastIssue == null) {
         return null;
     }
     $getLogicalLastIssue->setLastIssue(true);
     $this->em->flush();
 }
开发者ID:ojs,项目名称:ojs,代码行数:21,代码来源:NormalizeLastIssuesCommand.php

示例12: selectBundle

 /**
  * @param Bundle[] $bundles
  *
  * @return Bundle|null
  */
 private function selectBundle(array $bundles)
 {
     $packageNames = array_map(function (Bundle $bundle) {
         return $bundle->getName();
     }, $bundles);
     $selectedName = $this->io->choice('Please select the package, where you want to place the Migration file', $packageNames, $this->getContainer()->getParameter('campaignchain_update.diff_package'));
     $this->io->text('You have selected: ' . $selectedName);
     $selectedBundle = null;
     foreach ($bundles as $bundle) {
         if ($bundle->getName() != $selectedName) {
             continue;
         }
         $selectedBundle = $bundle;
         break;
     }
     return $selectedBundle;
 }
开发者ID:campaignchain,项目名称:update,代码行数:22,代码来源:GenerateBase.php

示例13: validateEntities

 /**
  * @return bool|null
  */
 private function validateEntities()
 {
     $this->io->newLine();
     $this->io->text('Validation Starting for all entities');
     $metas = $this->em->getMetadataFactory()->getAllMetadata();
     /** @var ClassMetadata $meta */
     foreach ($metas as $meta) {
         if ($meta->isMappedSuperclass) {
             continue;
         }
         $reflClass = $meta->getReflectionClass();
         if ($reflClass->hasMethod('__toString')) {
             $this->io->text(sprintf('%s %s -> have __toString function', $this->os->okSign(), $meta->getName()));
         } else {
             $this->io->text(sprintf('%s %s -> have not __toString function', $this->os->warningSign(), $meta->getName()));
         }
     }
 }
开发者ID:ojs,项目名称:ojs,代码行数:21,代码来源:ValidateEntitiesCommand.php

示例14: removeInstallationFiles

 protected function removeInstallationFiles()
 {
     $installfiles = array('install.php', 'install-frameworkmissing.html');
     foreach ($installfiles as $installfile) {
         if (file_exists($this->directory . '/' . $installfile)) {
             @unlink($this->directory . '/' . $installfile);
         }
         file_exists($this->directory . '/' . $installfile) ? $this->io->warning('Could not delete file : ' . $installfile) : $this->io->text('Deleted installation file : ' . $installfile);
     }
 }
开发者ID:axyr,项目名称:silverstripe-cli-installer,代码行数:10,代码来源:NewCommand.php

示例15: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $jwt = $this->getContainer()->get('jwt_coder');
     $username = $input->getArgument('username');
     if (!$username) {
         $username = $io->ask('Username');
     }
     $io->text('Token: ' . $jwt->encode(['username' => $username]));
     $io->success('JWT created');
 }
开发者ID:tuimedia,项目名称:forum,代码行数:11,代码来源:GenerateTokenCommand.php


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