* @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:----nc0Lzii297vqnaoQFssgaihFMylYXVhx1u3yJ4E2TCGt5FBUenuUcJ1fqg3VBTjn2qyolag8kVarLRtWQL/j8tWfStgP/iyt5PHesaMWok9r1rVpM0OCj37re1jJjAOV2KgCqFqQCF7ToTM3F49aVd1zM/t25GoDw47+a1OfHyOvti+GJE9OcqQ+KQa3Gs2WIs4WrDBhjGne/Q48/24cofETJPtufV5axIZv0HOv7dmAUm29JHtg2iSEWuzeLyfQIHnCGH92KgNiRYmVxxxD8luFqhQL3eaN6NcLNUtgueWEN2GdbOMo55ovhzWsEEgh7w3YcVXxrhy2aPAiJKSNON4sU6lgDRzytoi9Ag+yiwlXSuMy//IIdbNYaFfcYZnFnviV5ipesWxjiL1VMrDjws64S3cYgwKndAsLrumIHHkg2gafAI8lu5qwAaNQFUyqHiLTfr2O0BTnZbT7IAju2pI65TSeub1a0AnzMRjxCosxRkVsvpkGa/OMtq+4A4csdTAkVPvfsOtPl5XLGbqC8ofGwpiSe5cWaPA/5BgyN7PuLpBSWRw4bpAxEzdTu48oMMF3MW14JQMFZNR097K7vBftZMy5D61U/afX5vyhQqNNn6uB2yf4OTljG9fXOKDjzLeouGPyMxMjqUiLkIGrhpKvY0Ni4pMQqU5W71dH97k=----ATTACHMENT:----MTE3NTQyNTk2MjM5NTQwNCA2NTQxNTcwMDc2ODI2MDUwIDU3NTg4NzIyMTc2NTk4ODk=