mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-10-31 18:47:33 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			33 lines
		
	
	
		
			761 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			761 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| /**
 | |
|  * @link https://www.yiiframework.com/
 | |
|  * @copyright Copyright (c) 2008 Yii Software LLC
 | |
|  * @license https://www.yiiframework.com/license/
 | |
|  */
 | |
| 
 | |
| 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;
 | |
|     }
 | |
| }
 | 
