當前位置: 首頁>>代碼示例>>PHP>>正文


PHP OutputInterface::isVerbose方法代碼示例

本文整理匯總了PHP中Symfony\Component\Console\Output\OutputInterface::isVerbose方法的典型用法代碼示例。如果您正苦於以下問題:PHP OutputInterface::isVerbose方法的具體用法?PHP OutputInterface::isVerbose怎麽用?PHP OutputInterface::isVerbose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\Console\Output\OutputInterface的用法示例。


在下文中一共展示了OutputInterface::isVerbose方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: verboseWriteln

 /**
  * Verbose write line
  *
  * @param string $area Area
  * @param string $line Line
  */
 public static function verboseWriteln($area, $line)
 {
     if (self::$output->isVerbose()) {
         // Special stuff if line is exception
         if ($line instanceof \Exception) {
             /** @var \Exception $e */
             $e = $line;
             $line = array();
             $line[] = '--- EXCEPTION ---';
             $line[] = $e->getMessage();
             $line[] = ' FILE: ' . $e->getFile();
             $line[] = ' LINE: ' . $e->getLine();
             $line = implode("\n", $line);
         }
         // Process lines
         $lineList = explode("\n", $line);
         if (count($lineList) >= 1) {
             unset($line);
             foreach ($lineList as &$line) {
                 $line = '   ' . ltrim($line);
             }
             unset($line);
             $line = implode("\n", $lineList);
         }
         $line = sprintf("<info>[VERBOSE %s]</info>\n<comment>%s</comment>\n", $area, $line);
         self::$output->writeln($line);
     }
 }
開發者ID:jousch,項目名稱:clitools,代碼行數:34,代碼來源:ConsoleUtility.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln('[incidents:reports]: Starting.');
     $output->write('[incidents:reports]: Getting reports...');
     try {
         $report_files = glob($this->getContainer()->getParameter('cert_unlp.ngen.incident.report.markdown.path') . '/*');
         // get all file names
         $common_report_files = glob($this->getContainer()->getParameter('cert_unlp.ngen.incident.report.markdown.path') . '/common/*');
         $output->writeln('Done');
         foreach ($report_files as $file) {
             // iterate files
             $filename = basename($file);
             if (!in_array($filename, ['TODO.md', 'template.md', 'common'])) {
                 if ($output->isVerbose()) {
                     $output->writeln('[incidents:reports]: parsing ' . $filename);
                 }
                 $html = $this->getContainer()->get('markdown.parser')->transformMarkdown(file_get_contents($file));
                 file_put_contents($this->getContainer()->getParameter('cert_unlp.ngen.incident.report.twig.path') . "/" . str_replace(".md", "Report.html.twig", basename($file)), $html);
             }
         }
         foreach ($common_report_files as $file) {
             // iterate files
             $filename = basename($file);
             if ($output->isVerbose()) {
                 $output->writeln('[incidents:reports]: parsing ' . $filename);
             }
             $html = $this->getContainer()->get('markdown.parser')->transformMarkdown(file_get_contents($file), false);
             file_put_contents($this->getContainer()->getParameter('cert_unlp.ngen.incident.report.twig.path') . "/BaseReport/" . str_replace(".md", "Report.html.twig", basename($file)), $html);
         }
     } catch (Exception $ex) {
         $output->writeln('[incidents:reports]: Something is wrong.');
     }
     $output->writeln('[incidents:reports]: Done.');
 }
開發者ID:CERTUNLP,項目名稱:NgenBundle,代碼行數:34,代碼來源:RefreshIncidentReportsCommand.php

示例3: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $range = $input->getArgument('range') ?: (isset($_SERVER['TRAVIS_COMMIT_RANGE']) ? $_SERVER['TRAVIS_COMMIT_RANGE'] : '');
     if (!$range) {
         throw new \RuntimeException("No git range given via argument or TRAVIS_COMMIT_RANGE environment variable.");
     }
     exec('git diff --name-only ' . escapeshellarg($range), $result);
     $build = new Build(new ConsoleIO($input, $output, $this->getHelperSet()));
     $this->packages = $build->loadPackages(getcwd());
     $changePackageName = rtrim($input->getArgument('package'), '/');
     $this->calculateDependencies($changePackageName);
     if ($output->isVerbose()) {
         $output->writeln('Checking for changes in the following directories:');
         foreach ($this->checkPaths as $checkPath) {
             $output->writeln('- ' . $checkPath);
         }
         $output->writeln(sprintf('Iterating the changed files in git commit range %s', $range));
     }
     $found = false;
     foreach ($result as $changedFile) {
         if ($output->isVerbose()) {
             $output->writeln(sprintf("- %s", $changedFile));
         }
         foreach ($this->checkPaths as $checkPath) {
             if (strpos(trim($changedFile), $checkPath) !== false) {
                 if ($output->isVerbose()) {
                     $output->writeln(sprintf('  Matches check path %s', $checkPath));
                 }
                 $found = true;
             }
         }
     }
     exit($found ? 0 : 1);
 }
開發者ID:beberlei,項目名稱:composer-monorepo-plugin,代碼行數:34,代碼來源:GitChangedCommand.php

示例4: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /* Get requests in the desired time frame. */
     $em = $this->getContainer()->get('doctrine')->getManager();
     $date = new \DateTime($input->getOption('time_frame'));
     $requests = $em->getRepository('SwdAnalyzerBundle:Request')->findByDate($date)->getResult();
     if (empty($requests)) {
         if ($output->isVerbose()) {
             $output->writeln('No requests found');
         }
         return;
     }
     /* Send e-mails to all users that have specified an address. */
     $users = $em->getRepository('SwdAnalyzerBundle:User')->findByEmail()->getResult();
     if (empty($users)) {
         if ($output->isVerbose()) {
             $output->writeln('No e-mail addresses found');
         }
         return;
     }
     foreach ($users as $user) {
         if ($output->isVerbose()) {
             $output->writeln('Send email to ' . $user->getEmail());
         }
         $message = \Swift_Message::newInstance()->setSubject('Shadow Daemon Report')->setFrom('noreply@zecure.org')->setTo($user->getEmail())->setBody($this->getContainer()->get('templating')->render('SwdAnalyzerBundle:Report:email.txt.twig', array('requests' => $requests)));
         $this->getContainer()->get('mailer')->send($message);
     }
 }
開發者ID:sbilly,項目名稱:shadowd_ui,代碼行數:28,代碼來源:ReportCommand.php

示例5: write

 /**
  * @param $message
  */
 public function write($message)
 {
     if ($this->output instanceof Output && !$this->output->isVerbose()) {
         $this->output->write('.');
     } else {
         $this->output->write($message);
     }
 }
開發者ID:simpspector,項目名稱:analyser,代碼行數:11,代碼來源:ConsoleLogger.php

示例6: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $config = $input->getArgument('config');
     if ($config) {
         try {
             $this->loadConfig($config);
         } catch (\Exception $e) {
             if (!$output->isQuiet()) {
                 $output->writeln(sprintf("Failed to load config: %s", $e->getMessage()));
             }
             exit(1);
         }
     }
     if (empty($this->config)) {
         if (!$output->isQuiet()) {
             $output->writeln("No configuration found.");
         }
         exit(1);
     }
     try {
         $params = array('version' => $this->config->getVersion(), 'region' => $this->config->getRegion(), 'credentials' => array('key' => $this->config->getCredentials()->getKey(), 'secret' => $this->config->getCredentials()->getSecret()));
         if ($this->config->getTimeout() !== NULL) {
             $params['http']['timeout'] = $this->config->getTimeout();
         }
         $client = new S3Client($params);
     } catch (\Exception $e) {
         if (!$output->isQuiet()) {
             $output->writeln("Failed to connect to AWS.");
         }
         exit(1);
     }
     foreach ($this->config->getBuckets() as $bucket) {
         // Make sure the Bucket's destination is writable.
         $destination = $bucket->getDestination();
         if (!is_writable($destination)) {
             $output->writeln(sprintf('Failed to write to destination "%s".', $destination));
             exit(1);
         }
         if ($bucket->getObjects()) {
             try {
                 $this->fetchBucketByObjects($bucket, $client);
             } catch (\Exception $e) {
                 if ($output->isVerbose()) {
                     $output->writeln(sprintf('An error occured fetching Bucket "%s": %s', $bucket->getName(), $e->getMessage()));
                 }
             }
         } else {
             try {
                 $this->fetchBucketByLimit($bucket, $client);
             } catch (\Exception $e) {
                 if ($output->isVerbose()) {
                     $output->writeln(sprintf('An error occured fetching Bucket "%s": %s', $bucket->getName(), $e->getMessage()));
                 }
             }
         }
     }
     return true;
 }
開發者ID:squeegycode,項目名稱:s3download,代碼行數:58,代碼來源:Download.php

示例7: log

 protected function log($message, $verbosity = 1)
 {
     if (!$this->output instanceof OutputInterface) {
         return $this;
     }
     if (1 == $verbosity && $this->output->isVerbose()) {
         $this->output->writeln($message);
     }
     if (2 == $verbosity && $this->output->isVeryVerbose()) {
         $this->output->writeln('    ' . $message);
     }
     return $this;
 }
開發者ID:TonyBogdanov,項目名稱:faviconr,代碼行數:13,代碼來源:Faviconr.php

示例8: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $args = [];
     $out = $input->getOption('out');
     $psr4 = $input->getOption('psr4');
     $protoc = $input->getOption('protoc');
     $protos = $input->getArgument('protos');
     $include = $input->getOption('include') ?: [];
     $builder = $this->createProcessBuilder($this->plugin, $protoc);
     if ($output->isVerbose()) {
         $args['verbose'] = 1;
     }
     if ($input->getOption('generate-imported')) {
         $args['generate-imported'] = 1;
     }
     if ($psr4) {
         $args['psr4'] = $psr4;
     }
     if ($input->getOption('include-descriptors')) {
         $builder->setIncludeDescriptors(true);
         $builder->setDescriptorPaths([__DIR__ . '/../../../google-protobuf-proto/src', __DIR__ . '/../../vendor/protobuf-php/google-protobuf-proto/src']);
     }
     $builder->assertVersion();
     $process = $builder->createProcess($out, $protos, $include, $args);
     $command = $process->getCommandLine();
     if ($output->isVerbose()) {
         $output->writeln("Generating protos with protoc -- {$command}");
     }
     // Run command
     $process->run(function ($type, $buffer) use($output) {
         if (!$output->isVerbose() || !$buffer) {
             return;
         }
         $output->writeln($buffer);
     });
     $return = $process->getExitCode();
     $result = $process->getOutput();
     if ($return === 0) {
         $output->writeln("<info>PHP classes successfully generate.</info>");
         return $return;
     }
     $output->writeln('<error>protoc exited with an error (' . $return . ') when executed with: </error>');
     $output->writeln('');
     $output->writeln('  ' . $command);
     $output->writeln('');
     $output->writeln($result);
     $output->writeln('');
     $output->writeln($process->getErrorOutput());
     $output->writeln('');
     return $return;
 }
開發者ID:protobuf-php,項目名稱:protobuf-plugin,代碼行數:54,代碼來源:GenerateCommand.php

示例9: compare

 public function compare()
 {
     if (empty($this->stack)) {
         throw new \InvalidArgumentException('Stack not set');
     }
     if (empty($this->blueprint)) {
         throw new \InvalidArgumentException('Blueprint not set');
     }
     $tmp = [];
     try {
         // parameters
         if ($this->output->isVerbose()) {
             $this->output->writeln($this->stack->getName() . ': Comparing parameters');
         }
         $parametersStack = $this->stack->getParameters();
         $parametersBlueprint = $this->blueprint->getParameters(true);
         $parametersBlueprint = Div::flatten($parametersBlueprint, 'ParameterKey', 'ParameterValue');
         if ($this->parametersAreEqual($parametersStack, $parametersBlueprint)) {
             $tmp['parameters'] = "<fg=green>equal</>";
         } else {
             $tmp['parameters'] = "<fg=red>different</>";
             $tmp['error'] = true;
         }
         // template
         if ($this->output->isVerbose()) {
             $this->output->writeln($this->stack->getName() . ': Comparing template');
         }
         $templateStack = trim($this->stack->getTemplate());
         $templateBlueprint = trim($this->blueprint->getPreprocessedTemplate());
         $templateStack = $this->normalizeJson($templateStack);
         $templateBlueprint = $this->normalizeJson($templateBlueprint);
         if ($templateStack === $templateBlueprint) {
             $tmp['template'] = "<fg=green>equal</>";
         } else {
             $tmp['template'] = "<fg=red>different</>";
             $tmp['error'] = true;
         }
     } catch (CloudFormationException $e) {
         $tmp['parameters'] = 'Stack not found';
         $tmp['template'] = 'Stack not found';
         $tmp['error'] = true;
     } catch (\Exception $e) {
         $tmp['parameters'] = '<fg=red>EXCEPTION: ' . $e->getMessage() . '</>';
         $tmp['template'] = 'EXCEPTION';
         $tmp['error'] = true;
     }
     return $tmp;
 }
開發者ID:aoepeople,項目名稱:stackformation,代碼行數:48,代碼來源:Diff.php

示例10: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $realCacheDir = $this->getContainer()->getParameter('kernel.cache_dir');
     // the old cache dir name must not be longer than the real one to avoid exceeding
     // the maximum length of a directory or file path within it (esp. Windows MAX_PATH)
     $oldCacheDir = substr($realCacheDir, 0, -1) . ('~' === substr($realCacheDir, -1) ? '+' : '~');
     $filesystem = $this->getContainer()->get('filesystem');
     if (!is_writable($realCacheDir)) {
         throw new \RuntimeException(sprintf('Unable to write in the "%s" directory', $realCacheDir));
     }
     if ($filesystem->exists($oldCacheDir)) {
         $filesystem->remove($oldCacheDir);
     }
     $kernel = $this->getContainer()->get('kernel');
     $output->writeln(sprintf('Clearing the cache for the <info>%s</info> environment with debug <info>%s</info>', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));
     $this->getContainer()->get('cache_clearer')->clear($realCacheDir);
     if ($input->getOption('no-warmup')) {
         $filesystem->rename($realCacheDir, $oldCacheDir);
     } else {
         // the warmup cache dir name must have the same length than the real one
         // to avoid the many problems in serialized resources files
         $realCacheDir = realpath($realCacheDir);
         $warmupDir = substr($realCacheDir, 0, -1) . ('_' === substr($realCacheDir, -1) ? '-' : '_');
         if ($filesystem->exists($warmupDir)) {
             if ($output->isVerbose()) {
                 $output->writeln('  Clearing outdated warmup directory');
             }
             $filesystem->remove($warmupDir);
         }
         if ($output->isVerbose()) {
             $output->writeln('  Warming up cache');
         }
         $this->warmup($warmupDir, $realCacheDir, !$input->getOption('no-optional-warmers'));
         $filesystem->rename($realCacheDir, $oldCacheDir);
         if ('\\' === DIRECTORY_SEPARATOR) {
             sleep(1);
             // workaround for Windows PHP rename bug
         }
         $filesystem->rename($warmupDir, $realCacheDir);
     }
     if ($output->isVerbose()) {
         $output->writeln('  Removing old cache directory');
     }
     $filesystem->remove($oldCacheDir);
     if ($output->isVerbose()) {
         $output->writeln('  Done');
     }
 }
開發者ID:Milkyway2605,項目名稱:EasyStage_Symfony,代碼行數:51,代碼來源:CacheClearCommand.php

示例11: _execute

 protected function _execute(InputInterface $input, OutputInterface $output)
 {
     $group = $input->getArgument('group');
     $name = $input->getArgument('name');
     $isDefault = $input->getOption('default');
     if (!$name) {
         $name = $group;
     }
     $cnx = \jDb::getConnection('jacl2_profile');
     try {
         $sql = "INSERT into " . $cnx->prefixTable('jacl2_group') . " (id_aclgrp, name, grouptype, ownerlogin) VALUES (";
         $sql .= $cnx->quote($group) . ',';
         $sql .= $cnx->quote($name) . ',';
         if ($isDefault) {
             $sql .= '1, NULL)';
         } else {
             $sql .= '0, NULL)';
         }
         $cnx->exec($sql);
     } catch (\Exception $e) {
         throw new \Exception("this group already exists");
     }
     if ($output->isVerbose()) {
         $output->writeln("Group '" . $group . "' is created");
     }
 }
開發者ID:mdouchin,項目名稱:jelix,代碼行數:26,代碼來源:GroupCreate.php

示例12: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $limit = intval($input->getOption('limit'));
     if ($limit <= 0) {
         throw new \InvalidArgumentException('"limit" number must be positive');
     }
     foreach ($this->numberGenerator($limit) as $i) {
         if ($output->isVerbose()) {
             $output->write("{$i}: ");
         }
         if ($i % 3 === 0) {
             if ($i % 5 === 0) {
                 $this->showFizzBuzz($output);
             } else {
                 $this->showFizz($output);
             }
         } else {
             if ($i % 5 === 0) {
                 $this->showBuzz($output);
             } else {
                 $this->showNumber($output, $i);
             }
         }
     }
 }
開發者ID:hnw,項目名稱:fizzbuzz,代碼行數:25,代碼來源:FizzBuzzCommand.php

示例13: listAttendants

 /**
  * @return int
  */
 protected function listAttendants()
 {
     $attendants = array_map(function (CacheAttendantInterface $a) {
         return ClassInfo::getClassNameByInstance($a);
     }, $this->getCacheAttendants([], true));
     $header = ['Cache Registrar Name', 'Enabled', 'Initialized'];
     if ($this->output->isVerbose()) {
         $header = array_merge($header, ['TTL', 'Key Prefix', 'Hash Algo', 'Item Count']);
     }
     $rows = [];
     foreach ($attendants as $i => $name) {
         $instance = $this->getCacheAttendants([$name])[0];
         $rows[$i] = [$name, $instance->isEnabled() ? 'Yes' : '<fg=white>No</>', $instance->isInitialized() ? 'Yes' : '<fg=white>No</>'];
         if (!$this->output->isVerbose()) {
             continue;
         }
         $ttl = $this->getAttendantTtl($instance);
         $gen = $this->getAttendantKeyGenerator($instance);
         try {
             $num = count($instance->listKeys());
         } catch (\Exception $e) {
             $num = '<fg=white>n/a</>';
         }
         $rows[$i] = array_merge($rows[$i], [$ttl === 0 ? '<fg=white>0</>' : $ttl, $gen->getPrefix(), $gen->getAlgorithm(), $num]);
     }
     $this->io->section('Cache Registry Attendant Listing');
     $this->io->table($header, $rows);
     return 0;
 }
開發者ID:scr-be,項目名稱:teavee-object-cache-bundle,代碼行數:32,代碼來源:CacheClearCommand.php

示例14: run

 /**
  * Runs local command.
  *
  * @param  string $commandLine
  * @param  OutputInterface|null $output
  * @param null|string $cwd The working directory
  *
  * @return string
  */
 public function run($commandLine, OutputInterface $output = null, $cwd = null)
 {
     $previousCwd = getcwd();
     if ($cwd) {
         chdir($cwd);
         !$this->logger ?: $this->logger->debug(sprintf('Changed CWD to %s', $cwd));
     }
     !$this->logger ?: $this->logger->debug($commandLine);
     ob_start();
     passthru($commandLine, $returnStatus);
     if ($output instanceof OutputInterface) {
         if ($returnStatus != 0) {
             // execute with error
             $output->writeln('<error>' . trim(ob_get_contents()) . '</error>');
         } elseif ($output->isVerbose()) {
             $output->writeln(ob_get_contents(), OutputInterface::OUTPUT_RAW);
         }
     } elseif ($returnStatus != 0) {
         // execute with error
         if (!$this->logger) {
             throw new \RuntimeException(trim(ob_get_contents()));
         } else {
             $this->logger->debug(trim(ob_get_contents()));
         }
     }
     $this->lastReturnStatus = $returnStatus;
     !$previousCwd ?: chdir($previousCwd);
     return ob_get_clean();
 }
開發者ID:tonydub,項目名稱:jarvis,代碼行數:38,代碼來源:Exec.php

示例15: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $every = $this->validateDuration($input->getOption('every'));
     $needle = $input->getOption('search');
     $timeout = $this->validateDuration($input->getOption('timeout'));
     $urls = $this->validateURLs($input->getOption('urls'));
     if (!$needle) {
         throw new InvalidArgumentException('Needle must be provided');
     }
     $cycle = new MonitorCycle($urls, $timeout, $needle);
     while (true) {
         $last = new DateTimeImmutable();
         $output->writeln(sprintf('<bg=green>%s</>', $last->format('Y-m-d H:i:s')));
         list($success, $failed) = $cycle->run();
         if ($output->isVerbose() && count($failed) > 0) {
             $output->writeln(sprintf('<fg=red>Failed URLs:</> %s', implode("\n             ", $failed)));
         }
         $output->writeln(sprintf('<fg=green>%d</> successful; <fg=red>%d</> failed', count($success), count($failed)));
         $output->writeln('');
         $next = $last->add(new DateInterval("PT{$every}S"));
         do {
             sleep(1);
         } while (new DateTimeImmutable() < $next);
     }
 }
開發者ID:LawnGnome,項目名稱:mirror-monitor,代碼行數:25,代碼來源:MonitorCommand.php


注:本文中的Symfony\Component\Console\Output\OutputInterface::isVerbose方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。