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


PHP ConsoleOutput::writeln方法代码示例

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


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

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $rc = 0;
     try {
         if (!$input->getOption('force')) {
             if (!$input->isInteractive()) {
                 throw new Exception("You have to specify the --force option in order to run this command");
             }
             $confirmQuestion = new ConfirmationQuestion('Are you sure you want to update this concrete5 installation?');
             if (!$this->getHelper('question')->ask($input, $output, $confirmQuestion)) {
                 throw new Exception("Operation aborted.");
             }
         }
         $configuration = new \Concrete\Core\Updater\Migrations\Configuration();
         $output = new ConsoleOutput();
         $configuration->setOutputWriter(new OutputWriter(function ($message) use($output) {
             $output->writeln($message);
         }));
         Update::updateToCurrentVersion($configuration);
     } catch (Exception $x) {
         $output->writeln('<error>' . $x->getMessage() . '</error>');
         $rc = 1;
     }
     return $rc;
 }
开发者ID:seebaermichi,项目名称:concrete5,代码行数:25,代码来源:UpdateCommand.php

示例2: overview

 public static function overview()
 {
     $printer = new ConsoleOutput();
     $printer->writeln('');
     $printer->writeln('Testing Environment');
     $printer->writeln('===================');
     $printer->writeln('Machine : ' . gethostname());
     $printer->writeln('Database : ' . Config::get('database.default'));
 }
开发者ID:sgh1986915,项目名称:laravel-bizgym,代码行数:9,代码来源:TestListener.php

示例3: destroyTestUser

 /**
  * Destroy a user that matches a test user name.
  *
  * @param $role
  * @return $this
  */
 public function destroyTestUser($role)
 {
     $this->output->writeln("deleting test{$role}User...");
     $users = \Drupal::entityQuery('user')->condition("name", "test{$role}User")->execute();
     $users = User::loadMultiple($users);
     foreach ($users as $user) {
         $user->delete();
     }
     return $this;
 }
开发者ID:dustinleblanc,项目名称:codeception-drupal-8,代码行数:16,代码来源:Drupal8.php

示例4: execute

 /**
  * Execute the product template migration
  */
 public function execute()
 {
     $productTemplates = $this->getProductTemplates();
     if (empty($productTemplates)) {
         $this->output->writeln('<info>There is no product template to update<info>');
         return;
     }
     $this->convert($productTemplates);
     $this->output->writeln('<info>Done !</info>');
 }
开发者ID:juliensnz,项目名称:pim-community-standard,代码行数:13,代码来源:migrate_product_template.php

示例5: execute_commands

/**
 * @param $commands
 * @param \Symfony\Component\Console\Output\ConsoleOutput $output
 * @return void
 */
function execute_commands($commands, $output)
{
    foreach ($commands as $command) {
        $output->writeln(sprintf('<info>Executing : </info> %s', $command));
        $p = new \Symfony\Component\Process\Process($command);
        $exit = $p->run(function ($type, $data) use($output) {
            $output->write($data);
        });
        $output->writeln("");
    }
}
开发者ID:karousn,项目名称:sandbox,代码行数:16,代码来源:load_data.php

示例6: processFiles

 public function processFiles($title, array $files, $process)
 {
     $o = new ConsoleOutput();
     $o->writeln('<info>' . $title . '</info>');
     $p = new ProgressBar($o, count($files));
     $p->start();
     foreach ($files as $path) {
         $process($path);
         $p->advance();
     }
     $p->finish();
     $o->writeln('');
 }
开发者ID:yrizos,项目名称:berk,代码行数:13,代码来源:Command.php

示例7: terminate

 /**
  * @inheritdoc
  */
 public function terminate(ResultCollection $collection, ResultCollection $groupedResults)
 {
     $output = new ConsoleOutput(OutputInterface::VERBOSITY_NORMAL, true);
     $output->write(str_pad("\r", 80, " "));
     $output->writeln('');
     // score
     $score = $collection->getScore();
     //        if($score) {
     foreach ($score->all() as $name => $value) {
         $output->writeln(sprintf('%s %s', str_pad($name, 35, '.'), str_pad($value, 5, ' ', STR_PAD_LEFT) . ' / ' . Scoring::MAX));
     }
     $output->writeln('');
     //        }
 }
开发者ID:truffo,项目名称:PhpMetrics,代码行数:17,代码来源:Cli.php

示例8: dump

 /**
  * @param $data
  * @param null|int $flags
  */
 public function dump($data, $flags = null)
 {
     if ($flags !== null) {
         if ($flags & self::NEWLINE_BEFORE) {
             $this->output->writeln('');
         }
     }
     $this->cliDumper->dump($this->varCloner->cloneVar($data));
     if ($flags !== null) {
         if ($flags & self::NEWLINE_AFTER) {
             $this->output->writeln('');
         }
     }
 }
开发者ID:sfie,项目名称:pimcore,代码行数:18,代码来源:Dumper.php

示例9: doDownLoad

 public function doDownLoad($limit_array)
 {
     $output = new ConsoleOutput();
     //        $bar = new ProgressBar($output,count($limit_array));
     //        $bar->start();
     //        $bar->setBarWidth(100);
     $i = 0;
     $count = count($limit_array);
     //        $bar->setFormat('debug');
     foreach ($limit_array as $file => $data) {
         //            $package = $this->repository_path."/packages/".$file.".json";
         $versions = $this->repository_path . "/download/" . $file . ".json";
         //            $package = json_decode(file_get_contents($package),true);
         $download = json_decode(file_get_contents($download), true);
         if (!$download) {
             $i++;
             $output->writeln($i . '/' . $count . ' skip');
             continue;
             //                $bar->advance();
         }
         $i++;
         $versions = array_values($download['package']['versions']);
         if (!isset($versions[0]['require'])) {
             $output->writeln($i . '/' . $count . ' skip');
             continue;
         }
         $output->writeln($i . '/' . $count);
         $package_name = strtolower($download['package']['name']);
         $project_name = substr($package_name, 0, strpos($package_name, '/'));
         //            echo strpos($package_name,'/').' '.$package_name."\r\n";exit;
         if (isset($versions[0]['require'])) {
             foreach ($versions[0]['require'] as $k => $v) {
                 R::findOrCreate("CpmRequire", array("package" => $package_name, "project" => $project_name, "require" => strtolower($k), "version" => strtolower($v)));
             }
         }
         if (isset($versions[0]['require-dev'])) {
             foreach ($versions[0]['require-dev'] as $k => $v) {
                 R::findOrCreate("CpmRequireDev", array("package" => $package_name, "project" => $project_name, "require" => strtolower($k), "version" => strtolower($v)));
             }
         }
         if (isset($versions[0]['keywords'])) {
             foreach ($versions[0]['keywords'] as $v) {
                 R::findOrCreate("CpmKeyword", array("package" => $package_name, "project" => $project_name, "keyword" => strtolower($v)));
             }
         }
     }
     //        $bar->finish();
     $output->writeln('');
 }
开发者ID:php-cpm,项目名称:cpm,代码行数:49,代码来源:DownloadCommandHandler.php

示例10: loadExternalConfig

 /**
  * Load the external config files specified by the command line option.
  */
 protected function loadExternalConfig()
 {
     $config = new Repository(static::getDefaultConfig());
     $filesystem = new Filesystem();
     foreach ($this->getConfigFiles($filesystem) as $filename) {
         $this->output->writeln("<info>Reading config from <path>{$filename}</path></info>");
         if ($filesystem->extension($filename) == 'php') {
             $configValues = $filesystem->getRequire($filename);
         } else {
             $configValues = Yaml::parse($filesystem->get($filename));
         }
         $config->set(array_dot($configValues));
     }
     $this->container->instance('config', $config);
 }
开发者ID:parsnick,项目名称:steak,代码行数:18,代码来源:Application.php

示例11: printDebug

 /**
  * Print a message out - useful for debugging
  *
  * @param $string
  */
 protected function printDebug($string)
 {
     if ($this->output === null) {
         $this->output = new ConsoleOutput();
     }
     $this->output->writeln($string);
 }
开发者ID:C3-TKO,项目名称:smash-api,代码行数:12,代码来源:ApiTestCase.php

示例12: execute_commands

/**
 * @param $commands
 * @param \Symfony\Component\Console\Output\ConsoleOutput $output
 *
 * @return boolean
 */
function execute_commands($commands, $output)
{
    foreach ($commands as $command) {
        $output->writeln(sprintf('<info>Executing : </info> %s', $command));
        $p = new \Symfony\Component\Process\Process($command);
        $p->setTimeout(null);
        $p->run(function ($type, $data) use($output) {
            $output->write($data);
        });
        if (!$p->isSuccessful()) {
            return false;
        }
        $output->writeln("");
    }
    return true;
}
开发者ID:awesemo,项目名称:cms-sandbox,代码行数:22,代码来源:load_data.php

示例13: runDatabaseMigrations

 /**
  * @before
  */
 public function runDatabaseMigrations()
 {
     if ($GLOBALS['run_database_migrations']) {
         return;
     }
     $GLOBALS['run_database_migrations'] = true;
     $output = new ConsoleOutput();
     if (getenv('SCHEMA_DUMP') == 1) {
         $output->writeln("Cleaning Database with artisan's <bg=green;options=bold>db:fix && db:schema:dump</>...");
         $this->artisan('db:fix');
         $this->artisan('db:schema:dump', ['--output-file' => 'tests/_data/dump.sql', '--binary' => 'true']);
     } else {
         $output->writeln("Restoring Database with artisan's <bg=green;options=bold>db:schema:restore</>...");
         $this->artisan('db:schema:restore', ['--schema-file' => 'tests/_data/dump.sql']);
     }
 }
开发者ID:KMK-ONLINE,项目名称:hack_todo,代码行数:19,代码来源:TestCase.php

示例14: listNodes

 protected function listNodes(array $nodes, $sortBy = self::SORT_BY_NAME)
 {
     switch ($sortBy) {
         case self::SORT_BY_NAME:
             usort($nodes, function ($a, $b) {
                 return strcasecmp($a['name'], $b['name']);
             });
             break;
         case self::SORT_BY_TIME:
             usort($nodes, function ($a, $b) {
                 return strtotime($a['modifiedDate']) < strtotime($b['modifiedDate']);
             });
             break;
     }
     foreach ($nodes as $node) {
         if ($node->inTrash() && !$this->config['display.trash']) {
             continue;
         }
         $modified = new \DateTime($node['modifiedDate']);
         if ($modified->format('Y') === date('Y')) {
             $date = $modified->format('M d H:m');
         } else {
             $date = $modified->format('M d  Y');
         }
         $name = $node['kind'] === 'FOLDER' ? "<blue>{$node['name']}</blue>" : $node['name'];
         $this->output->writeln(sprintf("%s  %s  %s %s %s %s", $node['id'], $date, str_pad($node['status'], 10), str_pad($node['kind'], 7), str_pad($this->convertFilesize($node['contentProperties']['size'], 0), 6), $name));
     }
 }
开发者ID:Zn4rK,项目名称:clouddrive-php,代码行数:28,代码来源:Command.php

示例15: __construct

 /**
  * @param string $name  application name
  * @param string $version application version
  * @SuppressWarnings(PHPMD.ExitExpression)
  */
 public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
 {
     $this->serviceManager = \Zend\Mvc\Application::init(require BP . '/setup/config/application.config.php')->getServiceManager();
     $generationDirectoryAccess = new GenerationDirectoryAccess($this->serviceManager);
     if (!$generationDirectoryAccess->check()) {
         $output = new ConsoleOutput();
         $output->writeln('<error>Command line user does not have read and write permissions on var/generation directory.  Please' . ' address this issue before using Magento command line.</error>');
         exit(0);
     }
     /**
      * Temporary workaround until the compiler is able to clear the generation directory
      * @todo remove after MAGETWO-44493 resolved
      */
     if (class_exists(CompilerPreparation::class)) {
         $compilerPreparation = new CompilerPreparation($this->serviceManager, new ArgvInput(), new File());
         $compilerPreparation->handleCompilerEnvironment();
     }
     if ($version == 'UNKNOWN') {
         $directoryList = new DirectoryList(BP);
         $composerJsonFinder = new ComposerJsonFinder($directoryList);
         $productMetadata = new ProductMetadata($composerJsonFinder);
         $version = $productMetadata->getVersion();
     }
     parent::__construct($name, $version);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:30,代码来源:Cli.php


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