31 lines
1.1 KiB
PHP
31 lines
1.1 KiB
PHP
|
<?php
|
||
|
namespace nur\mapper\base;
|
||
|
|
||
|
trait Tencoding {
|
||
|
/** @var string */
|
||
|
protected $ppInputEncoding;
|
||
|
|
||
|
/** @var string */
|
||
|
protected $ppOutputEncoding;
|
||
|
|
||
|
protected function encodingInput__afterSetParametrableParams(array $modifiedKeys): void {
|
||
|
$input_encoding = in_array("input_encoding", $modifiedKeys)? $this->ppInputEncoding: null;
|
||
|
$output_encoding = in_array("output_encoding", $modifiedKeys)? $this->ppOutputEncoding: null;
|
||
|
if ($input_encoding !== null) {
|
||
|
$args = [$input_encoding];
|
||
|
if ($output_encoding !== null) $args[] = $output_encoding;
|
||
|
$this->setEncodingFilter(...$args);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
protected function encodingOutput__afterSetParametrableParams(array $modifiedKeys): void {
|
||
|
$output_encoding = in_array("output_encoding", $modifiedKeys)? $this->ppOutputEncoding: null;
|
||
|
$input_encoding = in_array("input_encoding", $modifiedKeys)? $this->ppInputEncoding: null;
|
||
|
if ($output_encoding !== null) {
|
||
|
$args = [$output_encoding];
|
||
|
if ($input_encoding !== null) $args[] = $input_encoding;
|
||
|
$this->setEncodingFilter(...$args);
|
||
|
}
|
||
|
}
|
||
|
}
|