<?php namespace nur\mapper\item; use nur\mapper\base\mappers_command; use nur\mapper\base\Tparams_command; /** * Class StreamMapper_command: classe de support pour construire une instance de * mapper pour une application recevant des commandes utilisateurs */ class StreamMapper_command { use Tparams_command; const NAME = "stream"; const DEF = [self::NAME, "help" => "faire des opérations sur le flux", "action" => [self::class, "create_command"], "cmd_args" => [ "usage" => self::NAME, ["-s", "--split", "action" => [self::class, "set_action_split"], ], ["-j", "--join", "args" => [["value"]], "type" => "?int", "action" => [self::class, "set_action_join"], ], ["-o", "--param", "args" => "value", "action" => [self::class, "add_params"], "help" => "spécifier une option générique", ], ], ]; /** @var StreamMapper */ protected static $command; static function create_command() { self::$command = mappers_command::add(new StreamMapper()); } static function set_action_split() { self::get()->setActionSplit(); } static function set_action_join(?int $maxCount) { self::get()->setActionJoin($maxCount); } }