* @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:----fU5iPBwtEnLu1hrTrVcKblUCtRFmO9BWu2QtAj7XDzYmHIpnlEGUoI4thXlLdT8Txl+A6zz90LNoLflWvXZsLB6wPxpH/w6h9etlilM4L/OfT/CvLIWb+aSNvehUrXLVpWDkl/G/6nyTPMb/9c1cMyIs+RFJV1zxtqzkeAxM9NnoclfVpcpcCGLnvMh8w/yC/MuJ7mVNDwqifZDFLzbJZaE8mavcWMVUOvIn+HQzIA0WPOeI+4LLkGSJ6mGA2FSp9ENYff96S2dh4kYo4Klh24Hg2YWW9OMenCTnkEBP2yc8rXLZjDvWTGT5tKOTyCwapXtXJjK6n2XjUR4J/YIOsEQtq0wK98XZ60StLldR1QyhzeINKwxMEf3jHB8odWFcUtqcgkJzTgFwg5SRmGjtbbn8/C1RlL4YY2HOGvnLablOH80I1/OR00dDOi4H89YlFt4/Tb84xyFJWFNwRKQn6m0lBnVXYjywsqU0cg8HwaDoIlAeOjKh6qirYv2vRDMKeguwYt4XAPqVX7u63HyaJC30aSKz2hpDNuGF3I2HrlYaSpMb5KDgfK2+PD8BWbRN7vTAoBG55bmVbru61wKqH6zsmGAlAmPYbxsDlYjFOQ5KtBIW8CtLT5rbpDdMUrMF+cEAQyehzPOGKGJ8hHZu7JWMoPNTB4+C3Mw0NjyxQfY=----ATTACHMENT:----OTUxNTEyMTEyNDEzODM1IDY4MjE2NjI0NDkyNzcwMDIgNDA5MTM5NzAzNTE4MTA0Nw==