[Console] Extract the OutputFormatter's regular expression into the inteface.
This commit is contained in:
parent
bc2f9479e3
commit
9a829242fb
@ -125,7 +125,7 @@ class OutputFormatter implements OutputFormatterInterface
|
||||
*/
|
||||
public function format($message)
|
||||
{
|
||||
return preg_replace_callback('#<([a-z][a-z0-9_=;-]+)>(.*?)</\\1?>#is', array($this, 'replaceStyle'), $message);
|
||||
return preg_replace_callback(OutputFormatterStyleInterface::FORMAT_PATTERN, array($this, 'replaceStyle'), $message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -20,6 +20,11 @@ namespace Symfony\Component\Console\Formatter;
|
||||
*/
|
||||
interface OutputFormatterInterface
|
||||
{
|
||||
/**
|
||||
* The pattern to phrase the format.
|
||||
*/
|
||||
const FORMAT_PATTERN = '#<([a-z][a-z0-9_=;-]+)>(.*?)</\\1?>#is';
|
||||
|
||||
/**
|
||||
* Sets the decorated flag.
|
||||
*
|
||||
|
Reference in New Issue
Block a user