You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace yiiunit\framework\console\controllers;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* StdOutBufferControllerTrait is a trait, which can be applied to [[yii\console\Controller]],
|
|
|
|
* allowing to store all output into internal buffer instead of direct sending it to 'stdout'
|
|
|
|
*/
|
|
|
|
trait StdOutBufferControllerTrait
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var string output buffer.
|
|
|
|
*/
|
|
|
|
private $stdOutBuffer = '';
|
|
|
|
|
|
|
|
public function stdout($string)
|
|
|
|
{
|
|
|
|
$this->stdOutBuffer .= $string;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function flushStdOutBuffer()
|
|
|
|
{
|
|
|
|
$result = $this->stdOutBuffer;
|
|
|
|
$this->stdOutBuffer = '';
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
}
|