<?php namespace nur\mapper\line; use nur\mapper\base\mappers_command; use nur\mapper\base\Tparams_command; /** * Class IconvMapper_command: classe de support pour construire une instance de * mapper pour une application recevant des commandes utilisateurs */ class IconvMapper_command { use Tparams_command; const NAME = "iconv"; const DEF = [self::NAME, "help" => "convertir l'encoding", "action" => [self::class, "create_command"], "cmd_args" => [ "usage" => self::NAME, ["-f", "--from", "args" => "value", "action" => [self::class, "set_input_encoding"], ], ["-t", "--to", "args" => "value", "action" => [self::class, "set_output_encoding"], ], ["-o", "--param", "args" => "value", "action" => [self::class, "add_params"], "help" => "spécifier une option générique", ], ], ]; /** @var IconvMapper */ protected static $command; static function create_command() { self::$command = mappers_command::add(new IconvMapper()); } static function set_input_encoding(string $input_encoding) { self::get()->setInputEncoding($input_encoding); } static function set_output_encoding(string $output_encoding) { self::get()->setOutputEncoding($output_encoding); } }