Created
August 22, 2012 02:07
-
-
Save predakanga/3421469 to your computer and use it in GitHub Desktop.
MemoryOutput
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Fusion\Framework\CronBundle\Command; | |
use Symfony\Component\Console\Output\Output; | |
/** | |
* MemoryOutput implements OutputInterface, writing to an internal buffer | |
*/ | |
class MemoryOutput extends Output { | |
protected $backingStore = ""; | |
public function __construct($verbosity = self::VERBOSITY_NORMAL) { | |
parent::__construct($verbosity); | |
} | |
public function doWrite($message, $newline) { | |
$this->backingStore .= $message; | |
if($newline) { | |
$this->backingStore .= "\n"; | |
} | |
} | |
public function getOutput() { | |
return $this->backingStore; | |
} | |
public function clear() { | |
$this->backingStore = ""; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment