本文整理匯總了PHP中Symfony\Component\Console\Formatter\OutputFormatter::setDecorated方法的典型用法代碼示例。如果您正苦於以下問題:PHP OutputFormatter::setDecorated方法的具體用法?PHP OutputFormatter::setDecorated怎麽用?PHP OutputFormatter::setDecorated使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\Console\Formatter\OutputFormatter
的用法示例。
在下文中一共展示了OutputFormatter::setDecorated方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: removeFormat
/**
* {@inheritdoc}
*/
public function removeFormat($string)
{
$this->innerFormatter->setDecorated(false);
$formatted = $this->innerFormatter->format($string);
$this->innerFormatter->setDecorated(true);
return $formatted;
}
示例2: testNotDecoratedFormatter
public function testNotDecoratedFormatter()
{
$formatter = new OutputFormatter(false);
$this->assertTrue($formatter->hasStyle('error'));
$this->assertTrue($formatter->hasStyle('info'));
$this->assertTrue($formatter->hasStyle('comment'));
$this->assertTrue($formatter->hasStyle('question'));
$this->assertEquals("some error", $formatter->format('<error>some error</error>'));
$this->assertEquals("some info", $formatter->format('<info>some info</info>'));
$this->assertEquals("some comment", $formatter->format('<comment>some comment</comment>'));
$this->assertEquals("some question", $formatter->format('<question>some question</question>'));
$formatter->setDecorated(true);
$this->assertEquals("[37;41msome error[0m", $formatter->format('<error>some error</error>'));
$this->assertEquals("[32msome info[0m", $formatter->format('<info>some info</info>'));
$this->assertEquals("[33msome comment[0m", $formatter->format('<comment>some comment</comment>'));
$this->assertEquals("[30;46msome question[0m", $formatter->format('<question>some question</question>'));
}