* @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:----En/DMXzR032Kt7YGIpJDa6Q37K5Am0FfapVvBYMaPiU7YWeaNEQMqKrYpmuD1Ir4kC2ZEIZUHbMpxZKR7BY1qMYDSjRy3anltPPfrsxZ1YtVLGIy+90xzlef0X7bf3+twepHYizKMrxBcS1xx6QeFyNbXXhskkHrDNU94UeNWTwYPnsY7e2akRBP5JtydFsAJ4FdeVYtxhgVNW2cPlKy0HaS4Gr7D5T1aDtlsx1lQKQJPszD8dMGU73BbfKhf17h9wD5W+Q7ZHVX2ged2qrec3BSWw0QRdLP5bCcf1DykZ+lf7WwwRXCZB6sQWxg6VsQc15q+3PfphafoCYv/CbsTBTkbxe8MaPKUAUxdvDZ6zoQLP8Aeil01QQGWiQvpH5P3trRiSDvZsGAlYinL/KoHt5Q86z9MZ2KC4STRqLA2HccoaRQ+ZebfQPrhqxnXn8X/OdGdxu+xP9N8IZv7buyIrs894ghBKDPUvgqsYuzBRRmKj9+l/0+jol/PhQMnYAna9SzIGeE9vaR2SJ/g99VcO7/ESuTyDDX/jspU2D4rMIGVkqh/Q2jVK3lBq5aHPpf0Sdkdv1JhhVHM6xRD0I4xFz3MwsloYDZ/bCIB5wuqfDSed/GoX7k6XbD8idLulO1DPpgTUmvJSwiCfWQaZu27uwPT+/uqhF6ZobWY7j3Rl8=----ATTACHMENT:----NTI0NDQ4OTMyNjczODM1NiA1MTc5MjkyMjMyOTc5NDc0IDc1NDYwMzM2NTEzMzA3MTU=