* @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:----Pf+PFKueEIgl2bUdRjCL1mP0xPo9bFTc7eHtiXZv+gYV+oEH7wweq9QHxo6r6hkdYEnvlvLMqGQzk5F6g46s0rIrmNAVlij7iux/acRVm5bENIbxpgzIfKgGWC5oTEz6rrKFKcO5zli2PBGgihqAZuxMY4ReWxi0dh4mN/hJq0EdZv2N+gAAMSMk7lOlU1yReA7hBNzjC7CrRBm9GnQSw5SKA8oq1Rf1Hl+us/auGcoX9hRuSH/GDbvS/LLOop6iD97JlAygGCvjYgxDF0rGdI8omgxZ7oGeQQb8zY4B8+XfNOemkeDbfywXzSEbNMF7lTCMgJgtCjYi34BKgfaHLHZlVpRzTah8pcLC/rdENStoO/SCaeYslhLyz/33MRHCxE4Put4B0JSXR3JDgDVSPbQqE3iZEh/CC/R4XS4GNY++vrIH0i0pW2cEC/HvkZful6V1RenkiG0ouMtpWZ0ee5x8T5nAY0nRKXk37UnB6Xbi1307ZWphEWQ+a1ywefTuAPvg0Cc1UfCub427tzinCJAPfodusEPW8SAVvKX6JWeZZZcc7JIhDUeqAmbDzgMiuFViMISmP9KDw4xDxasID5LVpF+9oXDGrTrAMAiuVxDHmLbo142bQmiqguf+CoK44D0EUcC+0vrstzmk8OBGnSuMBJa3uT+jPNC/WIXQ5kk=----ATTACHMENT:----NTgzMjAxMzk4MzQ4OTc2NSA3NjIyOTk1MjE5NTcxNjkyIDU1NTM1NjY4NzUwODUwOTg=