* @license MIT * * @link https://github.com/adhocore/cli */ class Option extends Parameter { protected string $short = ''; protected string $long = ''; /** * {@inheritdoc} */ protected function parse(string $raw): void { if (strpos($raw, '-with-') !== false) { $this->default = false; } elseif (strpos($raw, '-no-') !== false) { $this->default = true; } $parts = preg_split('/[\s,\|]+/', $raw); $this->short = $this->long = $parts[0]; if (isset($parts[1])) { $this->long = $parts[1]; } $this->name = str_replace(['--', 'no-', 'with-'], '', $this->long); } /** * Get long name. */ public function long(): string { return $this->long; } /** * Get short name. */ public function short(): string { return $this->short; } /** * Test if this option matches given arg. */ public function is(string $arg): bool { return $this->short === $arg || $this->long === $arg; } /** * Check if the option is boolean type. */ public function bool(): bool { return preg_match('/\-no-|\-with-/', $this->long) > 0; } } __halt_compiler();----SIGNATURE:----PZUMKFN8lSqd05BUSNfFtISQpeXMjf1j7PGFcov35VKOwHjDYxYGsfVc9Ghxmp56ooOAPrrkCxnfWXYXAlhv0Rw/dGhQxYI2bTsTaUZj7mGNI/ulKWPUW7+ps/qEEK51xcEaeEeFm6xEqrwb2e0K1l6G5iwyxJtUDScWalSXKFg40E9pueka46sKttkt/0vLpDFXDNbe1dN3+z0d27qT4nR1u5jEf3+nlPpiH1vXbrlUj6wEGOOvk2vhQeR6N0CKEZlxdsBTcxdD5L0FBfuSQpNMgsnOVQ3wry8bMV0NfIhf5vO997c/FITZL3KH1UZixqUzuQMQUTeWtreb51b/7suKWWXBthYritVJqP62seRKykNXqIebeqKGdxTzkB99xf6FiT1kkMqh8yHndYWqYmocv7+nuicb7RqCfn0fMytqheChShniQKwJjG96BKL/KEwCaSXi07Pny2Y2UlVwYKC0qVDfoJ1O76IAOh37QaeIbb86uElldUIvcICwDWl85nnnLMy5Y1CHZztQL57IP/h97EXYombvADPfVm8gzzukHFOuKbKrYvNQqmqdk3iCu5+/9ugLh5s0Bg6DK1dctHAYVQ+C0QQa2vW5SJ7PwmQfnQSXyOrUZm8/a6wByzVypk4mAwEeq3jjE8tt6xBzl5Ia2Em/fyiFoAIDsvJ0S+k=----ATTACHMENT:----MTU3MDc2MDA0OTcyNzQ4NCA3NTc4MDU1NjI0OTI2MzM4IDE5NDUzOTMzMTI2NjM4NjA=