nur-sery/nur_src/b/io/StringWriter.php

40 lines
758 B
PHP
Raw Normal View History

2023-12-03 22:10:18 +04:00
<?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 {
}
}