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 { class out {
/** @var StdOutput */ /** @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 */ /** reparamétrer l'instance */
static function reset($output=null, ?array $params=null): StdOutput { static function reset($output=null, ?array $params=null): StdOutput {
if (self::$out === null) { if (self::$out === null) return self::set(new StdOutput($output, $params));
return self::$out = new StdOutput($output, $params);
}
if ($output !== null) $params["output"] = $output; if ($output !== null) $params["output"] = $output;
self::$out->resetParams($params); self::$out->resetParams($params);
return self::$out; return self::$out;
} }
static function get(): StdOutput { static function write(...$values): void { self::$out->write(...$values); }
if (self::$out !== null) return self::$out; static function print(...$values): void { self::$out->print(...$values); }
else return self::reset();
}
static function write(...$values): void { self::get()->write(...$values); } static function iwrite(int $indentLevel, ...$values): void { self::$out->iwrite($indentLevel, ...$values); }
static function print(...$values): void { self::get()->print(...$values); } static function iprint(int $indentLevel, ...$values): void { self::$out->iprint($indentLevel, ...$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); }
} }
out::reset();