40 lines
		
	
	
		
			758 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			758 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| namespace nur\b\io;
 | |
| 
 | |
| class StringWriter implements IWriter {
 | |
|   use Twriter;
 | |
| 
 | |
|   function __construct() {
 | |
|     $this->data = [];
 | |
|   }
 | |
| 
 | |
|   /** @var array */
 | |
|   private $data;
 | |
| 
 | |
|   function getString(bool $reset=true): string {
 | |
|     $string = implode("", $this->data);
 | |
|     if ($reset) $this->data = [];
 | |
|     return $string;
 | |
|   }
 | |
| 
 | |
|   function getResource() {
 | |
|     return null;
 | |
|   }
 | |
| 
 | |
|   function appendFilter(string $filterName, ?int $readWrite=null, $params=null): void {
 | |
|   }
 | |
| 
 | |
|   function prependFilter(string $filterName, ?int $readWrite=null, $params=null): void {
 | |
|   }
 | |
| 
 | |
|   function setEncodingFilter(string $to, string $from="utf-8"): void {
 | |
|   }
 | |
| 
 | |
|   function _write(string $value): void {
 | |
|     $this->data[] = $value;
 | |
|   }
 | |
| 
 | |
|   function close(bool $close=true): void {
 | |
|   }
 | |
| }
 |