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


PHP SymfonyStyle::writeln方法代码示例

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


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

示例1: execute

 /**
  * {@inheritdoc}
  *
  * @throws \LogicException
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $name = $input->getArgument('name');
     if (empty($name)) {
         $io->comment('Provide the name of a bundle as the first argument of this command to dump its default configuration.');
         $io->newLine();
         $this->listBundles($output);
         return;
     }
     $extension = $this->findExtension($name);
     $configuration = $extension->getConfiguration(array(), $this->getContainerBuilder());
     $this->validateConfiguration($extension, $configuration);
     if ($name === $extension->getAlias()) {
         $message = sprintf('Default configuration for extension with alias: "%s"', $name);
     } else {
         $message = sprintf('Default configuration for "%s"', $name);
     }
     switch ($input->getOption('format')) {
         case 'yaml':
             $io->writeln(sprintf('# %s', $message));
             $dumper = new YamlReferenceDumper();
             break;
         case 'xml':
             $io->writeln(sprintf('<!-- %s -->', $message));
             $dumper = new XmlReferenceDumper();
             break;
         default:
             $io->writeln($message);
             throw new \InvalidArgumentException('Only the yaml and xml formats are supported.');
     }
     $io->writeln($dumper->dump($configuration, $extension->getNamespace()));
 }
开发者ID:alekitto,项目名称:symfony,代码行数:38,代码来源:ConfigDumpReferenceCommand.php

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

示例3: execute

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io->title($this->getDescription());
     foreach ($this->apiViews as $apiView) {
         $bufferOutput = new BufferedOutput();
         $this->application->run(new StringInput(sprintf('api:doc:dump --view=%s', $apiView)), $bufferOutput);
         $viewDump = $bufferOutput->fetch();
         $viewDumpFile = __DIR__ . '/../Resources/doc/' . $apiView . '-api-doc.md';
         file_put_contents($viewDumpFile, $viewDump);
         $this->io->writeln(sprintf("%s -> view dumped to %s", $apiView, $viewDumpFile));
     }
 }
开发者ID:ojs,项目名称:ojs,代码行数:17,代码来源:ApiDocsDumpCommand.php

示例4: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output = new SymfonyStyle($input, $output);
     $this->partInput = new ConsoleInput($output);
     $creator = $this->makeCreator($input);
     $package = $creator->create();
     $this->config->addPackage($package);
     $path = $package->getPath();
     $output->writeln("<info>Package directory {$path} created.</info>");
     $output->writeln("<comment>Running composer install for new package...</comment>");
     Shell::run('composer install --prefer-dist', $package->getPath());
     $output->writeln("<info>Package successfully created.</info>");
     $this->refreshAutoloads($output, $package);
 }
开发者ID:mlanin-forks,项目名称:studio,代码行数:14,代码来源:CreateCommand.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());
     $roles = explode(',', $input->getArgument('roles'));
     if (!is_array($roles) || count($roles) < 1) {
         throw new \LogicException('Specify min. 1 role');
     }
     $users = $this->em->getRepository('OjsUserBundle:User')->findUsersByJournalRole($roles);
     $this->io->writeln('"user_id", "username", "first_name", "last_name", "email"');
     /** @var User $user */
     foreach ($users as $user) {
         $this->io->writeln(sprintf('%s, "%s", "%s", "%s", "%s"', $user->getId(), $user->getUsername(), $user->getFirstName(), $user->getLastName(), $user->getEmail()));
     }
 }
开发者ID:ojs,项目名称:ojs,代码行数:19,代码来源:UserListByRolesCommand.php

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

示例7: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     if (false !== strpos($input->getFirstArgument(), ':d')) {
         $io->caution('The use of "config:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:config" instead.');
     }
     $name = $input->getArgument('name');
     if (empty($name)) {
         $io->comment('Provide the name of a bundle as the first argument of this command to dump its configuration.');
         $io->newLine();
         $this->listBundles($output);
         return;
     }
     $extension = $this->findExtension($name);
     $container = $this->compileContainer();
     $configs = $container->getExtensionConfig($extension->getAlias());
     $configuration = $extension->getConfiguration($configs, $container);
     $this->validateConfiguration($extension, $configuration);
     $configs = $container->getParameterBag()->resolveValue($configs);
     $processor = new Processor();
     $config = $processor->processConfiguration($configuration, $configs);
     if ($name === $extension->getAlias()) {
         $io->title(sprintf('Current configuration for extension with alias "%s"', $name));
     } else {
         $io->title(sprintf('Current configuration for "%s"', $name));
     }
     $io->writeln(Yaml::dump(array($extension->getAlias() => $config), 10));
 }
开发者ID:robhaverkort,项目名称:belasting,代码行数:31,代码来源:ConfigDebugCommand.php

示例8: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $name = $input->getArgument('name');
     if (empty($name)) {
         $io->comment('Provide the name of a bundle as the first argument of this command to dump its configuration.');
         $io->newLine();
         $this->listBundles($output);
         return;
     }
     $extension = $this->findExtension($name);
     $container = $this->compileContainer();
     $configs = $container->getExtensionConfig($extension->getAlias());
     $configuration = $extension->getConfiguration($configs, $container);
     $this->validateConfiguration($extension, $configuration);
     $configs = $container->getParameterBag()->resolveValue($configs);
     $processor = new Processor();
     $config = $processor->processConfiguration($configuration, $configs);
     if ($name === $extension->getAlias()) {
         $io->title(sprintf('Current configuration for extension with alias "%s"', $name));
     } else {
         $io->title(sprintf('Current configuration for "%s"', $name));
     }
     $io->writeln(Yaml::dump(array($extension->getAlias() => $config), 3));
 }
开发者ID:xingshanghe,项目名称:symfony,代码行数:28,代码来源:ConfigDebugCommand.php

示例9: execute

    /**
     * {@inheritdoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $io = new SymfonyStyle($input, $output);
        $commandTitle = '                     Majora Installer                    ';
        $commandHelper = <<<COMMAND_HELPER
    <info>This is installer for majora-standard-edition</info>
   
    Create project to <info>current directory</info>: 
    
        <comment>majora new <Project Name></comment>
        
    Create project <info>for path</info>: 
    
        <comment>majora new <Path></comment>
        
    Create project <info>based on a specific branch</info>: 
    
        <comment>majora new <Project Name> <BranchName> </comment>
        
        
        
COMMAND_HELPER;
        $io->title($commandTitle);
        $io->writeln($commandHelper);
    }
开发者ID:LinkValue,项目名称:MajoraInstaller,代码行数:28,代码来源:AboutCommand.php

示例10: syncEventDescription

 private function syncEventDescription(EventDetail $eventDetail, $lang)
 {
     $findTemplates = $this->em->getRepository('OjsJournalBundle:MailTemplate')->findBy(['type' => $eventDetail->getName(), 'lang' => $lang]);
     foreach ($findTemplates as $template) {
         $this->io->writeln(sprintf('Updating description for  -> %s', $eventDetail->getName()));
         $template->setDescription($this->translator->trans($eventDetail->getName(), [], null, $lang));
         $template->setUpdatedBy('cli');
         $this->em->persist($template);
     }
 }
开发者ID:ojs,项目名称:ojs,代码行数:10,代码来源:MailEventsSynchronizeCommand.php

示例11: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $io->title('Ajouter un fichier');
     $em = $this->getcontainer()->get('doctrine.orm.default_entity_manager');
     $SCrepo = $em->getRepository('evegAppBundle:SyntaxonCore');
     $UserRepo = $em->getRepository('evegUserBundle:User');
     $s = $SCrepo->findById($input->getArgument('SCid'));
     $SCdiag = $SCrepo->findById($input->getArgument('diagnosisOf'));
     $user = $UserRepo->findByUsername($input->getArgument('userName'))[0];
     $io->writeln('Updating (id: ' . $input->getArgument('SCid') . ') ' . $s->getSyntaxon());
     $io->writeln('    adding file ' . $input->getArgument('fileName'));
     $sFile = new SyntaxonFile();
     $sFile->setHit($input->getArgument('hit'))->setDiagnosisOf($SCdiag);
     $sFile->setSyntaxonCore($s);
     $sFile->setUser($user)->setType($input->getArgument('type'))->setVisibility($input->getArgument('visibility'))->setTitle($input->getArgument('title'))->setFileName($input->getArgument('fileName'))->setOriginalName($input->getArgument('originalName'))->setOriginalSyntaxonName($input->getArgument('originalSyntaxonName'))->setLicense('CC-BY-SA')->setUpdatedAt(new \DateTime('now'))->setUploadedAt(new \DateTime('now'));
     $s->addSyntaxonFile($sFile);
     $em->flush();
     $io->success('file added');
 }
开发者ID:steph-del,项目名称:eveg,代码行数:20,代码来源:addFileCommand.php

示例12: execute

 public function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $io->title('OpenCFP');
     $io->section('Clearing caches');
     $paths = [$this->app->cachePurifierPath(), $this->app->cacheTwigPath()];
     array_walk($paths, function ($path) use($io) {
         passthru(sprintf('rm -rf %s/*', $path));
         $io->writeln(sprintf('  * %s', $path));
     });
     $io->success('Cleared caches.');
 }
开发者ID:cgrandval,项目名称:opencfp,代码行数:12,代码来源:ClearCacheCommand.php

示例13: summarizeCommits

 /**
  * Summarize changes since last tag.
  */
 protected function summarizeCommits()
 {
     $last = $this->changelog->getLastRelease();
     if (!$last) {
         return;
     }
     $commits = $this->executeQuietly(['git', 'log', $last['name'] . '..HEAD', '--oneline']);
     $commits = explode(PHP_EOL, trim($commits));
     if (!$commits) {
         $this->output->writeln('Commits since <comment>' . $last['name'] . '</comment>:');
         $this->output->listing($commits);
     }
 }
开发者ID:Anahkiasen,项目名称:versioner,代码行数:16,代码来源:Versioner.php

示例14: generate

 /**
  * Generate the data while outputting updates.
  *
  * @param string $path
  *
  * @return void
  */
 public function generate($path)
 {
     $bar = new ProgressBar($this->output, $this->rows);
     $this->output->writeln("<info>Creating file with {$this->rows} rows at {$path}.</info>");
     $this->createFile($path);
     for ($i = 0; $i < $this->rows; $i++) {
         $this->writeRow();
         $bar->advance();
     }
     $this->writer->close();
     $bar->finish();
     $this->output->writeln(PHP_EOL . '<info>Complete.</info>');
 }
开发者ID:olsgreen,项目名称:sheet-faker,代码行数:20,代码来源:Generator.php

示例15: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $basePath = Application::basePath();
     chdir($basePath);
     $host = $input->getOption('host');
     $port = $input->getOption('port');
     $base = ProcessUtils::escapeArgument($basePath);
     $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder())->find(false));
     $io = new SymfonyStyle($input, $output);
     $io->newLine();
     $io->writeln('<info>Tagmeo development server started on http://' . $host . ':' . $port . '/</info>');
     $io->newLine();
     passthru($binary . ' -S ' . $host . ':' . $port . ' ' . $base . '/server.php');
 }
开发者ID:tagmeo,项目名称:framework,代码行数:14,代码来源:ServeCommand.php


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