modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2024-04-05 10:19:15 +04:00
parent dccd89d4a3
commit ce1b7f86cd
1 changed files with 14 additions and 13 deletions

View File

@ -8,26 +8,27 @@ use nur\sery\output\std\StdOutput;
*/
class out {
/** @var StdOutput */
protected static $out;
private static $out;
static function get(): StdOutput {
return self::$out;
}
protected static function set(StdOutput $out): StdOutput {
return self::$out = $out;
}
/** reparamétrer l'instance */
static function reset($output=null, ?array $params=null): StdOutput {
if (self::$out === null) {
return self::$out = new StdOutput($output, $params);
}
if (self::$out === null) return self::set(new StdOutput($output, $params));
if ($output !== null) $params["output"] = $output;
self::$out->resetParams($params);
return self::$out;
}
static function get(): StdOutput {
if (self::$out !== null) return self::$out;
else return self::reset();
}
static function write(...$values): void { self::$out->write(...$values); }
static function print(...$values): void { self::$out->print(...$values); }
static function write(...$values): void { self::get()->write(...$values); }
static function print(...$values): void { self::get()->print(...$values); }
static function iwrite(int $indentLevel, ...$values): void { self::get()->iwrite($indentLevel, ...$values); }
static function iprint(int $indentLevel, ...$values): void { self::get()->iprint($indentLevel, ...$values); }
static function iwrite(int $indentLevel, ...$values): void { self::$out->iwrite($indentLevel, ...$values); }
static function iprint(int $indentLevel, ...$values): void { self::$out->iprint($indentLevel, ...$values); }
}
out::reset();