* @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:----Iyck9wVUDOskDlGos7kKAUvo1DZAu5cN92vZ9NQXmZwwZED4nggVISh8tl79ic6OuTEt2CttkkVnTo5yHBPn7ARYyVKft7zjoawQHbEWJif0210hpVU8uYXMgy0H6kKgLUH2g5jRAj5x7TPeLdvLqi5EFbp48cE9KXh/dLbBAbHOPCpml0r7lSyWjOZk0a+hYeB/4On8NDAbFGrhOyG+7lhAbM7b2pMQCQn+O6HzFQCv5vB4a3ZQoYM1eMcbrZ/nuWSKLEmTHh3eCWXbiZSPbPWXaZLi5ao790NK24YVZqGLohttu2LeREwrMBdOEdCzpmb242reqYRLKKxjSMtGY6MVWzGucceRHOv0TSwcv0icvqesTTgWZSdmyYevXd6pvaCOUJjQGE8Awy5WBriQEGc6b/fxISNptRM49I1TPSzad76cYBDFatrA5xqCHihopqVF1XkEdZrc3nbIseqv8YU1rtjaeeFGJYKJwR49eEB49bBXzlaIcQ198HpVYww7Pbs7hOTkr5o/N0GUDrIRm9zzpiIAl57uz2tKpA8ZhJOFsBWf5CEZ5P9g/KaZrFBrzFnmtGEW2wt2P6CUV5CDN17GSZixRwQUebtlbNQsQHiUpdkbqtWNiEsNmwrYsPwfWMOATYpER2lmygptZTnb4tqj7iTAuDlvAlzxycMpVgk=----ATTACHMENT:----Mjg2NjgzNTAxMjYyODgxNiA1NTU3MDk3MTMzMTY2MjY2IDM2NzU0Njg0ODE3NjY1ODA=