本文整理匯總了PHP中Symfony\Component\Console\Output\OutputInterface::text方法的典型用法代碼示例。如果您正苦於以下問題:PHP OutputInterface::text方法的具體用法?PHP OutputInterface::text怎麽用?PHP OutputInterface::text使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\Console\Output\OutputInterface
的用法示例。
在下文中一共展示了OutputInterface::text方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: outputAppliedHandler
/**
* Outputs the handler that has been applied (resolved), but
* only if the given handler is not the same as the last
* handler.
*
* @param \Aedart\Scaffold\Contracts\Handlers\Handler $handler
*/
protected function outputAppliedHandler($handler)
{
$handlerClass = get_class($handler);
if ($handlerClass != $this->lastHandler) {
$this->lastHandler = $handlerClass;
$this->output->text("Using handler: {$handlerClass}");
}
}
示例2: renderException
private function renderException(OutputInterface $output, $template, \Twig_Error $exception, $file = null)
{
$line = $exception->getTemplateLine();
if ($file) {
$output->text(sprintf('<error> ERROR </error> in %s (line %s)', $file, $line));
} else {
$output->text(sprintf('<error> ERROR </error> (line %s)', $line));
}
foreach ($this->getContext($template, $line) as $lineNumber => $code) {
$output->text(sprintf('%s %-6s %s', $lineNumber === $line ? '<error> >> </error>' : ' ', $lineNumber, $code));
if ($lineNumber === $line) {
$output->text(sprintf('<error> >> %s</error> ', $exception->getRawMessage()));
}
}
}
示例3: outputExecutionInfo
/**
* Output execution status information to the console
*
* @param OutputInterface|StyleInterface $output
* @param ConsoleTask $task
* @param int $number The number of the task to be executed
* @param int $total The total amount of tasks to be executed
*/
protected function outputExecutionInfo($output, ConsoleTask $task, $number, $total)
{
$taskXofY = "Task ({$number}/{$total})";
// Special formatting, if Symfony Style is provided
if ($output instanceof StyleInterface) {
$output->section($task->getName());
$output->text($task->getDescription());
$output->text($taskXofY);
$output->newLine();
return;
}
// Std. formatting
$output->writeln($task->getName());
$output->writeln('--------------------------------');
$output->writeln($task->getDescription());
$output->writeln($taskXofY);
$output->writeln('');
}