nur-sery/nur_src/mapper/line/LineWriter.php

65 lines
1.6 KiB
PHP

<?php
namespace nur\mapper\line;
use nur\b\io\Tfilter;
use nur\b\params\Tparametrable;
use nur\data\types\Metadata;
use nur\mapper\base\Consumer;
use nur\mapper\base\encoding_utils;
use nur\mapper\base\Tencoding;
use nur\mapper\base\Ttmpwriter;
/**
* Class LineWriter
*
* --autogen-methods--
*/
class LineWriter extends Consumer {
use Tparametrable, Ttmpwriter, Tencoding, Tfilter;
function __construct($output=null) {
parent::__construct();
$this->pp_setOutput($output);
}
function setEncodingFilter(string $to, string $from="utf-8"): void {
$this->_setEncodingFilter($from, $to);
}
const PARAMETRABLE_PARAMS_SCHEMA = [
"output" => [null, null, "fichier en sortie"],
];
static function _get_parametrable_params_schema(): array {
return array_merge(self::PARAMETRABLE_PARAMS_SCHEMA
, encoding_utils::PARAMETRABLE_PARAMS_SCHEMA);
}
protected function afterSetParametrableParams(array $modifiedKeys, ?Metadata $md=null): void {
$this->encodingOutput__afterSetParametrableParams($modifiedKeys);
}
protected function setup(): void {
parent::setup();
$this->setupWriter(true);
}
function cook($item) {
$this->getWriter()->wnl($item);
}
protected function teardown(): void {
$this->teardownWriter(true);
}
#############################################################################
const _AUTOGEN_CONSTS = [
"" => [self::class, "_autogen_consts", true],
];
const _AUTOGEN_LITERALS = null;
const _AUTOGEN_METHODS = null;
const _AUTO_GETTERS = null;
const _AUTO_SETTERS = null;
#--autogen-dynamic--
}