* @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:----UXIj4I2nnfCmYRboeA1JAdS7zOMirb4YGvnDx09U97e5yTGgx++5oVtB0bjKB9iiYKU3O8kUMxroHWCkpD419JWGfAh4DqSh4l4OheGkVVcX996UQyEpbxET5/Xe0CF8XVJXN618WWTV+QjEOuuYAV78nOCc0uAo2Pebk5INhYxNbKUk+gwOnIuNvFXXWMdkUmYWsTG2XxQmyZStvdwIyqIUyXi6zvCNnTP4g2E9AI8Zw65UQFxpyZDomIPx2EHKV2zlv+q1h0Q6iOgbBu2ONvIGG37UokZrIw29xlH3Fb3PlZlYCODBjoBqJDbfJjygKgG5NghQJCihfO4gQNws7le78luDmeW4s5tPpI3ggPprULlugmMxGSaHOZrmmqCYh/Msl3VTuy4TVLP0mSy/EN/VS5ljdfLBjuqrhAo5WZOmNcwkzhEHZAghghTE9PahA6zJBzqY6mttcN027W0E746awVV7m8w99bKBRHoVZyyjDRlyujsntrwHp4L/ZsueTnhmsWtxiBJY4isXRsrGqBMDUQ24A798XglPWZG8DhSpmA4T/Yt3hVgcxwCXO/QZqs6sGX4GXyNk4xfPpY3liHryZUQkfGfB9c55CaVMQJNAdgixZ1lHEVYGiR26eWZNgnEcG6lIVSGjCwLGuk3HkvKaPzlO8w9OemqLE4KMIHo=----ATTACHMENT:----NTM0OTkxMDg4NzQ0NjExNiA5MjYwNzU2NjE4NzQ2NzkwIDk3MzU4NzUzNzc1ODg4NDk=