本文整理匯總了PHP中Symfony\Component\Console\Output\OutputInterface::isVeryVerbose方法的典型用法代碼示例。如果您正苦於以下問題:PHP OutputInterface::isVeryVerbose方法的具體用法?PHP OutputInterface::isVeryVerbose怎麽用?PHP OutputInterface::isVeryVerbose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\Console\Output\OutputInterface
的用法示例。
在下文中一共展示了OutputInterface::isVeryVerbose方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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;
}
示例2: run
/**
* Runs an external process.
*
* @param OutputInterface $output An OutputInterface instance
* @param string|array|Process $cmd An instance of Process or an array of arguments to escape and run or a command to run
* @param string|null $error An error message that must be displayed if something went wrong
* @param callable|null $callback A PHP callback to run whenever there is some
* output available on STDOUT or STDERR
*
* @return Process The process that ran
*/
public function run(OutputInterface $output, $cmd, $error = null, $callback = null)
{
$formatter = $this->getHelperSet()->get('debug_formatter');
if (is_array($cmd)) {
$process = ProcessBuilder::create($cmd)->getProcess();
} elseif ($cmd instanceof Process) {
$process = $cmd;
} else {
$process = new Process($cmd);
}
if ($output->isVeryVerbose()) {
$output->write($formatter->start(spl_object_hash($process), $process->getCommandLine()));
}
if ($output->isDebug()) {
$callback = $this->wrapCallback($output, $process, $callback);
}
$process->run($callback);
if ($output->isVeryVerbose()) {
$message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
$output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
}
if (!$process->isSuccessful() && null !== $error) {
$output->writeln(sprintf('<error>%s</error>', $error));
}
return $process;
}
示例3: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($this->installerIsUpdated()) {
return;
}
try {
$this->downloadNewVersion()->checkNewVersionIsValid()->backupCurrentVersion()->replaceCurrentVersionbyNewVersion()->cleanUp();
} catch (IOException $e) {
throw new \RuntimeException(sprintf("The installer couldn't be updated, probably because of a permissions issue.\n" . "Try to execute the command again with super user privileges:\n" . " sudo %s\n", $this->getExecutedCommand()));
if ($output->isVeryVerbose()) {
echo $e->getMessage();
}
} catch (\Exception $e) {
$this->rollback();
if ($output->isVeryVerbose()) {
echo $e->getMessage();
}
}
}
示例4: initialize
protected function initialize(InputInterface $input, OutputInterface $output)
{
$level = Reporter::VERBOSITY_ERROR;
if ($output->isQuiet()) {
$level = Reporter::VERBOSITY_NONE;
} elseif ($output->isVeryVerbose()) {
$level = Reporter::VERBOSITY_ALL;
}
$this->getContainer()->get('reporter')->setVerbosity($level);
if ($input->getOption('diff')) {
$this->diff = $input->getOption('diff');
}
}
示例5: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$destination = realpath($input->getArgument('moduledir'));
$hooksToFind = $this->getHooks();
$ourCwd = getcwd();
chdir($destination);
$modules = array();
$hooks = array();
// Loop through the hooks.
foreach ($hooksToFind as $hook) {
$commandOutput = '';
if ($output->isVerbose()) {
$output->writeln($hook);
}
// We're just grepping the tree for each function.
$command = "grep 'function .*_{$hook}(' * -Hnr";
if ($output->isVeryVerbose()) {
$output->writeln($command);
}
exec($command, $commandOutput);
// Iterate over the results, pulling out the name of the module.
// Note that for sandboxes, this will produce duplicates and could
// require further modifications.
foreach ($commandOutput as $line) {
list($file, ) = explode(':', $line);
$just_the_name = explode('/', $file);
$module_filename_parts = explode('.', end($just_the_name));
$module = reset($module_filename_parts);
$hooks[$hook][] = $module;
$modules[$module][] = $hook;
}
}
chdir($ourCwd);
// Write output.
$fh = fopen($input->getOption('output-hook'), 'w');
foreach ($hooks as $hook => $these_hooks) {
if (!empty($these_hooks)) {
fputcsv($fh, array($hook, implode(';', $these_hooks)));
}
}
fclose($fh);
$fm = fopen($input->getOption('output-modules'), 'w');
foreach ($modules as $module => $these_hooks) {
fputcsv($fm, array($module, implode(';', $these_hooks)));
}
fclose($fm);
return 0;
}
示例6: computeLogThreshold
public function computeLogThreshold(OutputInterface $output)
{
if ($output->isDebug()) {
return Logger::DEBUG;
}
if ($output->isVeryVerbose()) {
return Logger::INFO;
}
if ($output->isVerbose()) {
return Logger::INFO;
}
if ($output->isQuiet()) {
return \PHP_INT_MAX;
}
return Logger::WARNING;
}
示例7: deployFile
/**
* Deploy a static view file
*
* @param string $filePath
* @param string $area
* @param string $themePath
* @param string $locale
* @param string $module
* @return void
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
private function deployFile($filePath, $area, $themePath, $locale, $module)
{
$requestedPath = $filePath;
if (substr($filePath, -5) == '.less') {
$requestedPath = preg_replace('/.less$/', '.css', $filePath);
}
$logMessage = "Processing file '$filePath' for area '$area', theme '$themePath', locale '$locale'";
if ($module) {
$logMessage .= ", module '$module'";
}
if ($this->output->isVeryVerbose()) {
$this->output->writeln($logMessage);
}
try {
$asset = $this->assetRepo->createAsset(
$requestedPath,
['area' => $area, 'theme' => $themePath, 'locale' => $locale, 'module' => $module]
);
$asset = $this->minifyService->getAssets([$asset], true)[0];
if ($this->output->isVeryVerbose()) {
$this->output->writeln("\tDeploying the file to '{$asset->getPath()}'");
} else {
$this->output->write('.');
}
if ($this->isDryRun) {
$asset->getContent();
} else {
$this->assetPublisher->publish($asset);
$this->bundleManager->addAsset($asset);
}
$this->count++;
} catch (\Less_Exception_Compiler $e) {
$this->verboseLog(
"\tNotice: Could not parse LESS file '$filePath'. "
. "This may indicate that the file is incomplete, but this is acceptable. "
. "The file '$filePath' will be combined with another LESS file."
);
$this->verboseLog("\tCompiler error: " . $e->getMessage());
} catch (\Exception $e) {
$this->output->writeln($e->getMessage() . " ($logMessage)");
$this->verboseLog($e->getTraceAsString());
$this->errorCount++;
}
}
示例8: deployFile
/**
* Deploy a static view file
*
* @param string $filePath
* @param string $area
* @param string $themePath
* @param string $locale
* @param string $module
* @param string|null $fullPath
* @return string
* @throws \InvalidArgumentException
* @throws LocalizedException
*
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
private function deployFile($filePath, $area, $themePath, $locale, $module, $fullPath = null)
{
$compiledFile = '';
$extension = pathinfo($filePath, PATHINFO_EXTENSION);
foreach ($this->alternativeSources as $name => $alternative) {
if (in_array($extension, $alternative->getAlternativesExtensionsNames(), true) && strpos(basename($filePath), '_') !== 0) {
$compiledFile = substr($filePath, 0, strlen($filePath) - strlen($extension) - 1);
$compiledFile = $compiledFile . '.' . $name;
}
}
if ($this->output->isVeryVerbose()) {
$logMessage = "Processing file '{$filePath}' for area '{$area}', theme '{$themePath}', locale '{$locale}'";
if ($module) {
$logMessage .= ", module '{$module}'";
}
$this->output->writeln($logMessage);
}
try {
$asset = $this->assetRepo->createAsset($filePath, ['area' => $area, 'theme' => $themePath, 'locale' => $locale, 'module' => $module]);
if ($this->output->isVeryVerbose()) {
$this->output->writeln("\tDeploying the file to '{$asset->getPath()}'");
} else {
$this->output->write('.');
}
if ($this->getOption(Options::DRY_RUN)) {
$asset->getContent();
} else {
$this->assetPublisher->publish($asset);
$this->bundleManager->addAsset($asset);
}
$this->count++;
} catch (ContentProcessorException $exception) {
$pathInfo = $fullPath ?: $filePath;
$errorMessage = __('Compilation from source: ') . $pathInfo . PHP_EOL . $exception->getMessage();
$this->errorCount++;
$this->output->write(PHP_EOL . PHP_EOL . $errorMessage . PHP_EOL, true);
$this->getLogger()->critical($errorMessage);
} catch (\Exception $exception) {
$this->output->write('.');
$this->verboseLog($exception->getTraceAsString());
$this->errorCount++;
}
return $compiledFile;
}
示例9: createRemoteVendorDir
/**
* @param ProjectConfiguration $projectConfig
* @param OutputInterface $output
*
* @return int Exit code
*/
protected function createRemoteVendorDir(ProjectConfiguration $projectConfig, OutputInterface $output)
{
if ($output->isVeryVerbose()) {
$output->writeln(sprintf('<comment>Creates composer autoload file for use vendor dir "<info>%s</info>" for project "<info>%s</info>"</comment>', $projectConfig->getRemoteVendorDir(), $projectConfig->getProjectName()));
}
$filesystem = $this->getLocalFilesystem();
$filesystem->remove($projectConfig->getLocalWebappDir() . '/vendor');
$autoloadFilePath = $projectConfig->getLocalWebappDir() . '/vendor/autoload.php';
$autoloadContent = sprintf('<?php return require \'%s/autoload.php\';', $projectConfig->getRemoteVendorDir());
$filesystem->dumpFile($autoloadFilePath, $autoloadContent);
if ($output->isVeryVerbose()) {
$output->writeln(sprintf('<comment>Creates remote vendor dir for project "<info>%s</info>"</comment>', $projectConfig->getProjectName()));
}
$this->getSshExec()->exec(strtr('test -d %composer_vendor_dir% || mkdir -p %composer_vendor_dir%', ['%composer_vendor_dir%' => $projectConfig->getRemoteVendorDir()]));
if (0 !== $this->getSshExec()->getLastReturnStatus()) {
$this->getSshExec()->checkStatus($output);
}
return $this->getSshExec()->getLastReturnStatus();
}
示例10: parseOptions
/**
* Parse the command line options concerning the date of the last update
*
* @param string $lastUpdatePath The path to the last update file
* @param string $date|null The date command line argument
* @param OutputInterface $output The command's output
* @return void
*/
private function parseOptions($lastUpdatePath, $date, $output)
{
$message = null;
if ($date) {
$this->lastUpdateDate = \TimeDate::from($date)->startOfDay();
} elseif (!file_exists($lastUpdatePath)) {
$message = "Last update file not found, a new one is going to be created";
} else {
$message = $this->parseLastUpdate($lastUpdatePath);
}
if ($output->isVeryVerbose()) {
$output->writeln($message);
if ($this->lastUpdateDate) {
$formattedDate = $this->lastUpdateDate->toFormattedDateString();
$output->writeln("Showing changes since <options=bold>{$formattedDate}</options=bold>");
}
$output->writeln("");
}
}
示例11: execute
/**
* Execute the "scan" command
*
* @param InputInterface $input Input object
* @param OutputInterface $output Output object
* @throws RuntimeException If output format is not valid
* @return void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$dispatcher = new EventDispatcher();
$exitCode = new ExitCodeCatcher();
$dispatcher->addSubscriber($exitCode);
$fileIterator = new FileIterator($input->getArgument('path'), $this->parseCsv($input->getOption('ignore-paths')), $this->parseCsv($input->getOption('extensions')));
$format = strtolower($input->getOption('format'));
switch ($format) {
case 'dots':
case 'progress':
$output->writeln("<info>Parse: A PHP Security Scanner</info>\n");
if ($output->isVeryVerbose()) {
$dispatcher->addSubscriber(new ConsoleDebug($output));
} elseif ($output->isVerbose()) {
$dispatcher->addSubscriber(new ConsoleLines($output));
} elseif ('progress' == $format && $output->isDecorated()) {
$dispatcher->addSubscriber(new ConsoleProgressBar(new ProgressBar($output, count($fileIterator))));
} else {
$dispatcher->addSubscriber(new ConsoleDots($output));
}
$dispatcher->addSubscriber(new ConsoleReport($output));
break;
case 'xml':
$dispatcher->addSubscriber(new Xml($output));
break;
default:
throw new RuntimeException("Unknown output format '{$input->getOption('format')}'");
}
$ruleFactory = new RuleFactory($this->parseCsv($input->getOption('whitelist-rules')), $this->parseCsv($input->getOption('blacklist-rules')));
$ruleCollection = $ruleFactory->createRuleCollection();
$ruleNames = implode(',', array_map(function (RuleInterface $rule) {
return $rule->getName();
}, $ruleCollection->toArray()));
$dispatcher->dispatch(Events::DEBUG, new MessageEvent("Using ruleset {$ruleNames}"));
$docCommentFactory = new DocCommentFactory();
$scanner = new Scanner($dispatcher, new CallbackVisitor($ruleCollection, $docCommentFactory, !$input->getOption('disable-annotations')));
$scanner->scan($fileIterator);
return $exitCode->getExitCode();
}
示例12: doRun
/**
* Runs the current application.
*
* @param InputInterface $input An Input instance
* @param OutputInterface $output An Output instance
*
* @return integer 0 if everything went fine, or an error code
*/
public function doRun(InputInterface $input, OutputInterface $output)
{
//potentially override the environment
if ($input->hasParameterOption(array('--env', '-e'))) {
$this->neptune->setEnv($input->getParameterOption(array('--env', '-e')));
}
if ($output->isVeryVerbose() && $this->neptune->getEnv()) {
$output->writeln(sprintf('Using environment <info>%s</info>', $this->neptune->getEnv()));
}
//load the app configuration now to give a useful message if
//it fails
try {
$this->neptune['config'];
} catch (ConfigFileException $e) {
$this->renderException($e, $output);
$output->writeln('Run `<info>./vendor/bin/neptune-install .</info>` to set up a default configuration.');
return;
}
if (!$this->commands_registered) {
$this->registerCommands($output);
}
return parent::doRun($input, $output);
}
示例13: setupListeners
protected function setupListeners(EmitterInterface $emitter, OutputInterface $output)
{
if (!$output->isVerbose()) {
return;
}
$emitter->addListener('git_remote.repository_discovery', function ($event) use($output) {
/** @var GitRepositoryEvent $event */
$output->writeln(sprintf('Discovered repository <info>%s</info> at <comment>%s</comment>', $event->getRepository()->getName(), $event->getRepository()->getAnonymousUri()));
if ($output->isVeryVerbose()) {
$data = $event->getData();
$output->writeln(sprintf('Repository definition: %s', json_encode($data['definition'], JSON_PRETTY_PRINT)));
}
});
$emitter->addListener('git_guardian.pre_clone_repository', function ($event) use($output) {
/** @var GitRepositoryEvent $event */
$data = $event->getData();
$output->write(sprintf('Cloning <info>%s</info> into <comment>%s</comment> ', $event->getRepository()->getName(), $data['path']));
});
$emitter->addListener('git_guardian.create_git', function ($event) use($output) {
/** @var GitRepositoryEvent $event */
$output->write(sprintf('Preparing Git for <info>%s</info> in <comment>%s</comment> ', $event->getRepository()->getName(), $event->getGit()->getPath()));
});
$emitter->addListener('git_guardian.exception_repository', function ($event) use($output) {
/** @var GitRepositoryEvent $event */
$data = $event->getData();
$output->writeln(sprintf('[<error>Errored: %s</error>]', $data['exception']->getMessage()));
});
$emitter->addListener('git_guardian.config_skip_repository', function () use($output) {
/** @var GitRepositoryEvent $event */
$output->writeln('[<info>Skipped</info>]');
});
$emitter->addListener('git_guardian.post_fetch_repository', function () use($output) {
/** @var GitRepositoryEvent $event */
$output->writeln('[<info>Fetched</info>]');
});
}
示例14: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$source = realpath($input->getArgument(self::ARG_SOURCE));
$target = $input->getArgument(self::ARG_TARGET);
$force = $input->getOption('force');
if ($output->isVeryVerbose()) {
$message = sprintf('<info>Using %s as the hook.</info>', $source);
$output->writeln($message);
$message = sprintf('<info>Using %s for the install path.</info>', $target);
$output->writeln($message);
}
if (!file_exists($source)) {
$error = sprintf('<error>The hook %s does not exist!</error>', $source);
$output->writeln($error);
exit(1);
}
if (!is_dir(dirname($target))) {
$message = sprintf('<error>The directory at %s does not exist.</error>', $target);
$output->writeln($message);
exit(1);
}
if (file_exists($target) && $force) {
unlink($target);
$message = sprintf('<comment>Removed existing file at %s.</comment>', $target);
$output->writeln($message);
}
if (!file_exists($target) || $force) {
symlink($source, $target);
chmod($target, 0755);
$output->writeln('Symlink created.');
} else {
$message = sprintf('<error>A file at %s already exists.</error>', $target);
$output->writeln($message);
exit(1);
}
}
示例15: execute
/**
* @param InputInterface $input
* @param OutputInterface $output
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$verbosity = $output->getVerbosity();
if ($verbosity > 0) {
$verbosityMapping = [1 => Logger::WARNING, 2 => Logger::NOTICE, 3 => Logger::INFO, 4 => Logger::DEBUG];
$handler = new StreamHandler('php://stdout', $verbosityMapping[$verbosity]);
$handler->setFormatter(new ColoredLineFormatter());
$this->logger->pushHandler($handler);
}
if ($output->isVerbose()) {
$this->eventDispatcher->addListener(EventEnum::QUEUE_BINDED, function (AMQPQueueBindedEvent $event) use($output) {
$output->writeln('topic binded: ' . $event->getBindingKey());
});
$this->eventDispatcher->addListener(\Lexsign\StateMachine\Events\EventEnum::VALUE_UPDATED, function (ValueEvent $event) use($output) {
$changeSet = $event->getChangeSet();
if ($changeSet->hasChanged()) {
$output->writeln('<info>' . $changeSet->getTimestamp()->format(DateTime::ISO8601) . ' - ' . $changeSet->getKey() . ': ' . var_export($changeSet->getPreviousValue(), true) . ' -> ' . var_export($changeSet->getCurrentValue(), true) . '</info>');
}
});
}
if ($output->isVeryVerbose()) {
$this->eventDispatcher->addListener(\Lexsign\StateMachine\Events\EventEnum::VALUE_UPDATED, function (ValueEvent $event) use($output) {
$changeSet = $event->getChangeSet();
if (!$changeSet->hasChanged()) {
$output->writeln($changeSet->getTimestamp()->format(DateTime::ISO8601) . ' - ' . $changeSet->getKey() . ': not changed - ' . var_export($changeSet->getPreviousValue(), true));
}
});
}
if ($output->isDebug()) {
$this->eventDispatcher->addListener(EventEnum::INCOMING_MESSAGE, function (AMQPIncomingEvent $event) use($output) {
$msg = $event->getMessage();
$output->writeln('<comment>' . $msg->delivery_info['routing_key'] . ' - ' . $msg->body . '</comment>');
}, 1000);
}
$this->amqpFetcher->run();
}