Skip to content

Instantly share code, notes, and snippets.

@predakanga
Created August 22, 2012 02:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save predakanga/3421469 to your computer and use it in GitHub Desktop.
Save predakanga/3421469 to your computer and use it in GitHub Desktop.
MemoryOutput
<?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