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


PHP SymfonyStyle::success方法代码示例

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


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

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io = new SymfonyStyle($input, $output);
     $locator = $this->getContainer()->get('campaignchain.core.module.locator');
     $bundles = $locator->getAvailableBundles();
     $selectedBundle = $this->selectBundle($bundles);
     $generateOutput = new BufferedOutput();
     $application = new Application($this->getContainer()->get('kernel'));
     $application->setAutoExit(false);
     $application->run(new ArrayInput(['command' => $this->getDoctrineMigrationsCommand(), '--no-interaction' => true]), $generateOutput);
     preg_match('/Generated new migration class to "(.*)"/', $generateOutput->fetch(), $matches);
     if (count($matches) < 2) {
         //error
         return;
     }
     $pathForMigrationFile = $matches[1];
     preg_match('/Version.*.php/', $pathForMigrationFile, $fileNames);
     if (!count($fileNames)) {
         return;
     }
     $schemaFile = $this->getContainer()->getParameter('kernel.root_dir') . DIRECTORY_SEPARATOR . '..';
     $schemaFile .= DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . $selectedBundle->getName();
     $schemaFile .= str_replace('/', DIRECTORY_SEPARATOR, $this->getContainer()->getParameter('campaignchain_update.bundle.schema_dir'));
     $schemaFile .= DIRECTORY_SEPARATOR . $fileNames[0];
     $fs = new Filesystem();
     $fs->copy($pathForMigrationFile, $schemaFile);
     $fs->remove($pathForMigrationFile);
     $this->io->success('Generation finished. You can find the file here:');
     $this->io->text($schemaFile);
 }
开发者ID:campaignchain,项目名称:update,代码行数:30,代码来源:GenerateBase.php

示例2: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $mailerServiceName = sprintf('swiftmailer.mailer.%s', $input->getOption('mailer'));
     if (!$this->getContainer()->has($mailerServiceName)) {
         throw new \InvalidArgumentException(sprintf('The mailer "%s" does not exist.', $input->getOption('mailer')));
     }
     switch ($input->getOption('body-source')) {
         case 'file':
             $filename = $input->getOption('body');
             $content = file_get_contents($filename);
             if ($content === false) {
                 throw new \Exception(sprintf('Could not get contents from "%s".', $filename));
             }
             $input->setOption('body', $content);
             break;
         case 'stdin':
             break;
         default:
             throw new \InvalidArgumentException('Body-input option should be "stdin" or "file".');
     }
     $message = $this->createMessage($input);
     $mailer = $this->getContainer()->get($mailerServiceName);
     $sentMessages = $mailer->send($message);
     $this->io->success(sprintf('%s emails were successfully sent.', $sentMessages));
 }
开发者ID:symfony,项目名称:swiftmailer-bundle,代码行数:28,代码来源:NewEmailCommand.php

示例3: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $date = new \DateTime($input->getArgument('time'));
     // Get departure/arrival stops
     $departure = $this->cff->getStop($input->getArgument('departure'));
     $arrival = $this->cff->getStop($input->getArgument('arrival'));
     $output->write(sprintf('%s -> %s at %s : ', $departure['value'], $arrival['value'], $date->format('H:s')));
     $times = $this->cff->query($departure, $arrival, $date);
     $times = array_filter($times, function ($value) use($date) {
         return new \DateTime($value['departure']) == $date;
     });
     if ($infos = current($times)['infos']) {
         $output->writeln(sprintf('<comment>%s</comment>', $infos));
         // Create the Transport
         $transport = \Swift_SmtpTransport::newInstance($input->getOption('host'), $input->getOption('port'), $input->getOption('security'))->setUsername($input->getOption('username'))->setPassword($input->getOption('password'));
         $mailer = \Swift_Mailer::newInstance($transport);
         // Create a message
         $message = \Swift_Message::newInstance($infos)->setFrom(array($input->getOption('username') => 'CFFie'))->setTo(array($input->getOption('to')))->setBody(sprintf("%s -> %s at %s\nCFFie", $departure['value'], $arrival['value'], $date->format('H:m')));
         // Send the message
         $result = $mailer->send($message);
         if ($result) {
             $this->output->success($input->getOption('to') . ' alerted !');
         }
     } else {
         $output->writeln('<info>ok</info>');
     }
 }
开发者ID:maidmaid,项目名称:cffie,代码行数:27,代码来源:AlertCommand.php

示例4: success

 protected function success($message)
 {
     if ($this->verbose) {
         $this->io->success($message);
     } else {
         $this->output->writeln('[OK]' . $message);
     }
 }
开发者ID:carloboy7,项目名称:ownsongmovie,代码行数:8,代码来源:AbstractCommand.php

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

示例6: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $this->destinationPath = $input->getArgument('destination');
     $this->version = $input->getArgument('version');
     if (file_exists($this->destinationPath)) {
         throw new \InvalidArgumentException(sprintf('The directory %s already exists', $this->destinationPath));
     }
     $this->filesystem = new Filesystem();
     $io->writeln(PHP_EOL . ' Downloading Majora Standard Edition...' . PHP_EOL);
     $this->download($output);
     $io->writeln(PHP_EOL . PHP_EOL . ' Preparing project...' . PHP_EOL);
     $io->note('Extracting...');
     $this->extract();
     $io->note('Installing dependencies (this operation may take a while)...');
     $outputCallback = null;
     if ($output->getVerbosity() === OutputInterface::VERBOSITY_VERY_VERBOSE) {
         $outputCallback = function ($type, $buffer) use($output) {
             $output->write($buffer);
         };
     }
     $this->installComposerDependencies($outputCallback);
     $io->note('Cleaning...');
     $this->clean();
     $io->success([sprintf('Majora Standard Edition %s was successfully installed', $this->version)]);
 }
开发者ID:LinkValue,项目名称:MajoraInstaller,代码行数:29,代码来源:NewCommand.php

示例7: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $model = $input->getArgument('model');
     $seeds = $input->getArgument('seeds');
     $io = new SymfonyStyle($input, $output);
     if (!class_exists($model)) {
         $io->error(array('The model you specified does not exist.', 'You can create a model with the "model:create" command.'));
         return 1;
     }
     $this->dm = $this->createDocumentManager($input->getOption('server'));
     $faker = Faker\Factory::create();
     AnnotationRegistry::registerAutoloadNamespace('Hive\\Annotations', dirname(__FILE__) . '/../../');
     $reflectionClass = new \ReflectionClass($model);
     $properties = $reflectionClass->getProperties(\ReflectionProperty::IS_PUBLIC);
     $reader = new AnnotationReader();
     for ($i = 0; $i < $seeds; $i++) {
         $instance = new $model();
         foreach ($properties as $property) {
             $name = $property->getName();
             $seed = $reader->getPropertyAnnotation($property, 'Hive\\Annotations\\Seed');
             if ($seed !== null) {
                 $fake = $seed->fake;
                 if (class_exists($fake)) {
                     $instance->{$name} = $this->createFakeReference($fake);
                 } else {
                     $instance->{$name} = $faker->{$seed->fake};
                 }
             }
         }
         $this->dm->persist($instance);
     }
     $this->dm->flush();
     $io->success(array("Created {$seeds} seeds for {$model}"));
 }
开发者ID:100hz,项目名称:hive-console,代码行数:37,代码来源:ModelSeedCommand.php

示例8: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $io->title('Pre-commit delete');
     $git = new GitVersionControl();
     $projectBase = $git->getProjectBase();
     $hookDir = $projectBase . '/.git/hooks';
     if (!$io->confirm('Are you sure to remove Pre-commit hooks on this project?', true)) {
         exit(0);
     }
     $output->writeln('');
     if (!is_dir($hookDir)) {
         $io->error(sprintf('The git hook directory does not exist (%s)', $hookDir));
         exit(1);
     }
     $target = $hookDir . '/pre-commit';
     $fs = new Filesystem();
     if (is_file($target)) {
         $fs->remove($target);
         $io->success('pre-commit was deleted');
         exit(0);
     }
     $io->error(sprintf('pre-commit file does\'nt exist (%s)', $target));
     exit(1);
 }
开发者ID:edetaillac,项目名称:static-review,代码行数:28,代码来源:HookDeleteCommand.php

示例9: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $name = str_replace('/', '\\', $input->getArgument('name'));
     $this->migrator->set_output_handler(new log_wrapper_migrator_output_handler($this->language, new console_migrator_output_handler($this->user, $output), $this->phpbb_root_path . 'store/migrations_' . time() . '.log', $this->filesystem));
     $this->cache->purge();
     if (!in_array($name, $this->load_migrations())) {
         $io->error($this->language->lang('MIGRATION_NOT_VALID', $name));
         return 1;
     } else {
         if ($this->migrator->migration_state($name) === false) {
             $io->error($this->language->lang('MIGRATION_NOT_INSTALLED', $name));
             return 1;
         }
     }
     try {
         while ($this->migrator->migration_state($name) !== false) {
             $this->migrator->revert($name);
         }
     } catch (\phpbb\db\migration\exception $e) {
         $io->error($e->getLocalisedMessage($this->user));
         $this->finalise_update();
         return 1;
     }
     $this->finalise_update();
     $io->success($this->language->lang('INLINE_UPDATE_SUCCESSFUL'));
 }
开发者ID:phpbb,项目名称:phpbb,代码行数:27,代码来源:revert.php

示例10: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $io->title('Check Pre-commit requirements');
     $hasError = false;
     $resultOkVal = '<fg=green>✔</>';
     $resultNokVal = '<fg=red>✘</>';
     $commands = ['Composer' => array('command' => 'composer', 'result' => $resultOkVal), 'xmllint' => array('command' => 'xmllint', 'result' => $resultOkVal), 'jsonlint' => array('command' => 'jsonlint', 'result' => $resultOkVal), 'eslint' => array('command' => 'eslint', 'result' => $resultOkVal), 'sass-convert' => array('command' => 'sass-convert', 'result' => $resultOkVal), 'scss-lint' => array('command' => 'scss-lint', 'result' => $resultOkVal), 'phpcpd' => array('command' => 'phpcpd', 'result' => $resultOkVal), 'php-cs-fixer' => array('command' => 'php-cs-fixer', 'result' => $resultOkVal), 'phpmd' => array('command' => 'phpmd', 'result' => $resultOkVal), 'phpcs' => array('command' => 'phpcs', 'result' => $resultOkVal), 'box' => array('command' => 'box', 'result' => $resultOkVal)];
     foreach ($commands as $label => $command) {
         if (!$this->checkCommand($label, $command['command'])) {
             $commands[$label]['result'] = $resultNokVal;
             $hasError = true;
         }
     }
     // Check Php conf param phar.readonly
     if (!ini_get('phar.readonly')) {
         $commands['phar.readonly'] = array('result' => $resultOkVal);
     } else {
         $commands['phar.readonly'] = array('result' => 'not OK (set "phar.readonly = Off" on your php.ini)');
     }
     $headers = ['Command', 'check'];
     $rows = [];
     foreach ($commands as $label => $cmd) {
         $rows[] = [$label, $cmd['result']];
     }
     $io->table($headers, $rows);
     if (!$hasError) {
         $io->success('All Requirements are OK');
     } else {
         $io->note('Please fix all requirements');
     }
     exit(0);
 }
开发者ID:edetaillac,项目名称:static-review,代码行数:36,代码来源:CheckRequirementsCommand.php

示例11: execute

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io->title($this->getDescription());
     $this->io->progressStart(count($this->getJournals()));
     $counter = 1;
     foreach ($this->getJournals() as $journal) {
         $this->addTranslation($journal);
         $this->io->progressAdvance(1);
         $counter = $counter + 1;
         if ($counter % 50 == 0) {
             $this->em->flush();
         }
     }
     $this->em->flush();
     $this->io->success('All process finished');
 }
开发者ID:ojs,项目名称:ojs,代码行数:22,代码来源:JournalFooterTextNormalizeCommand.php

示例12: execute

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io->title($this->getDescription());
     $this->io->text('Issue Total View Normalize Started');
     $this->normalizeIssueTotalArticleView();
     $this->io->text('Issue Total Download Normalize Started');
     $this->normalizeIssueTotalArticleDownload();
     $this->io->newLine();
     $this->io->text('Journal Normalize Started');
     $this->normalizeJournalTotalArticleView();
     $this->io->text('Journal Total View Normalize Finished');
     $this->normalizeJournalTotalArticleDownload();
     $this->io->text('Journal Total Download Normalize Finished');
     $this->io->newLine(2);
     $this->io->success('All process finished');
 }
开发者ID:ojs,项目名称:ojs,代码行数:22,代码来源:StatsNormalizeCommand.php

示例13: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $io->comment("Warming up the cache (<info>{$this->cacheDir}</info>)");
     $this->cacheWarmer->warmup($this->cacheDir);
     $io->success('Cache warmed up');
 }
开发者ID:gnugat,项目名称:micro-framework-bundle,代码行数:10,代码来源:CacheWarmupCommand.php

示例14: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $fileInput = trim($input->getArgument('file'));
     $pathInfoFile = pathinfo(realpath($fileInput));
     $file = new File('', realpath($fileInput), $pathInfoFile['dirname']);
     $fileCollection = new FileCollection();
     $fileCollection = $fileCollection->append($file);
     $reporter = new Reporter($output, 1);
     $review = new StaticReview($reporter);
     $review->addReview(new PhpCsFixerReview(self::AUTO_ADD_GIT));
     // Review the staged files.
     $review->files($fileCollection);
     // Check if any matching issues were found.
     if ($reporter->hasIssues()) {
         $reporter->displayReport();
     }
     if ($reporter->hasIssueLevel(Issue::LEVEL_ERROR)) {
         $io->error('✘ Please fix the errors above.');
         exit(1);
     } else {
         $io->success('✔ Looking good.');
         exit(0);
     }
 }
开发者ID:edetaillac,项目名称:static-review,代码行数:28,代码来源:PhpCsFixerCommand.php

示例15: execute

 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $io->title('Import sentry events');
     $organisation = $input->getArgument('organisation');
     $project = $input->getArgument('project');
     $projectBlacklist = $input->getOption('project-blacklist');
     $sentryRequest = new SentryRequest($input->getOption('sentry-url'), $input->getOption('sentry-api-key'));
     $projects = [$project];
     if (null === $project) {
         $projects = $this->application['project.collector']->getSlugs($sentryRequest, $organisation);
     }
     $progress = new ProgressBar($output);
     $progress->start();
     foreach ($projects as $project) {
         if (in_array($project, $projectBlacklist)) {
             continue;
         }
         $simplifiedEvents = $this->application['event.collector']->getSimplifiedEvents($sentryRequest, $organisation, $project);
         foreach ($simplifiedEvents as $simplifiedEvent) {
             $this->application['importer']->import($organisation, $project, $simplifiedEvent);
             $progress->advance();
         }
     }
     $progress->finish();
     $io->newLine(2);
     $eventCount = $this->application['db']->fetchColumn('SELECT COUNT(*) FROM events');
     $io->success(sprintf('%s events are available.', $eventCount));
 }
开发者ID:enlightened-dc,项目名称:sentry-monitor,代码行数:35,代码来源:ImportCommand.php


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