* @license MIT * * @link https://github.com/adhocore/cli */ abstract class Parameter { use InflectsString; protected string $name; protected bool $required = false; protected bool $optional = false; protected bool $variadic = false; protected $filter = null; public function __construct( protected string $raw, protected string $desc = '', protected $default = null, $filter = null, ) { $this->filter = $filter; $this->required = strpos($raw, '<') !== false; $this->optional = strpos($raw, '[') !== false; $this->variadic = strpos($raw, '...') !== false; $this->parse($raw); } /** * Parse raw string representation of parameter. */ abstract protected function parse(string $raw): void; /** * Get raw definition. */ public function raw(): string { return $this->raw; } /** * Get name. */ public function name(): string { return $this->name; } /** * Get description. */ public function desc(): string { return $this->desc; } /** * Get normalized name. */ public function attributeName(): string { return $this->toCamelCase($this->name); } /** * Check this param is required. */ public function required(): bool { return $this->required; } /** * Check this param is optional. */ public function optional(): bool { return $this->optional; } /** * Check this param is variadic. */ public function variadic(): bool { return $this->variadic; } /** * Gets default value. */ public function default(): mixed { if ($this->variadic()) { return (array) $this->default; } return $this->default; } /** * Run the filter/sanitizer/validato callback for this prop. */ public function filter(mixed $raw): mixed { if ($this->filter) { $callback = $this->filter; return $callback($raw); } return $raw; } } __halt_compiler();----SIGNATURE:----P/0DTvOmFAJ+NlI49mol5TaSIjCZGUA2A3NvW+yQ+LbBTkHrVWeR+Bn2qgjzzafYAGdZbbNrUnnXRE4wXqAMZhYGxE6tNkfVDPIu6n+Asyxxy7SYUY5UGsDibV0EDT+oHCq2HRzEf/fJPrOEIN64kuNzbWHiHYipGmVRga+/4YZy7ux6EobquunD4gZLbxX576xZLf4A9drk8u5jU51s4g5Zl0ZJjEVu+UxIskfv/8cVe1pNwqOdfD4l1BN6bmRjzpcqRGrDJuolN+Z09Eysw8j1HGho/tZ6LfGtcVs3h+dLZuvHPnKVyuwE/kWx9fjEvTIMzGL3yJD6gLeUeeFl2fjZ04lzRw69Qm3QkwGkCiPsEq7D7xlPT909Vu3OykEKGMdSWL7jTp142tUa4SUgThBCZ50MqBto/RELwLx9AcqeOVmeeceExXGI+S+C2WES1/OyebUU+yQQ1UHcadATkRkx8vfQUY2uE3xY2/BwyUoMiK8lwlyz5H3Iy3+SGS9zMmTwuStcaDmu0NCplcnJGL94VZzK9QyhRDvc2bJ/F03vp2idkHMzfMxIOeKsHGLR8Q9qs8v312y99qJSn1g5wtm5PVT/X+SDIhgS5/uSIWdc3+4d9kV0MGCeFku9dSAwemU6ebZLhqzMY2nDG+DOGqGfqVdYGzWaKeLim8L91m0=----ATTACHMENT:----NDI4NzI3MDA0MDU5MjM5NiA4MTI4MDA2MDExNzQ3Njk3IDkwNTU1MTEwMjA1NDMwMzA=