nulib/php/src_output/out.php

35 lines
1.0 KiB
PHP

<?php
namespace nulib\output;
use nulib\output\std\StdOutput;
/**
* Class out: affichage sur la sortie standard
*/
class out {
/** @var StdOutput */
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::set(new StdOutput($output, $params));
if ($output !== null) $params["output"] = $output;
self::$out->resetParams($params);
return self::$out;
}
static function write(...$values): void { self::$out->write(...$values); }
static function print(...$values): void { self::$out->print(...$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();