for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* For licensing information, please see the LICENSE file accompanied with this file.
*
* @author Gerard van Helden <[email protected]>
* @copyright 2012 Gerard van Helden <http://melp.nl>
*/
namespace Zicht\Tool\Output;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Formatter\OutputFormatterStyleInterface;
class PrefixFormatter implements OutputFormatterInterface
{
public $prefix = '';
public function __construct(OutputFormatterInterface $innerFormatter)
$this->innerFormatter = $innerFormatter;
innerFormatter
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
}
* @{inheritDoc}
public function setDecorated($decorated)
return $this->innerFormatter->setDecorated($decorated);
public function isDecorated()
return $this->innerFormatter->isDecorated();
public function setStyle($name, OutputFormatterStyleInterface $style)
return $this->innerFormatter->setStyle($name, $style);
public function hasStyle($name)
return $this->innerFormatter->hasStyle($name);
public function getStyle($name)
return $this->innerFormatter->getStyle($name);
public function format($message)
$ret = $this->innerFormatter->format($message);
if ($this->prefix) {
$ret = preg_replace('/^/m', $this->prefix . '$1', $ret);
return $ret;
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: