* @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:----P5gbqJ1mQ3Qs45/bqIuPGFQgK7OV58Xh47qTK70MzR7VRb9QRBu2HZNv9sR9TB9+f8N5dGPUQaXVHEGtASCksCJ4bTVrsQDS/puFymlBo5zeScmov6UcYk7xtYN3I542Wqf4LRmCf3NXGWiXpwwsVKcRZ9ocyqosw15LqAcyN+ZU5StbRm6LzqX8rksmuCbNx4brrdHzcxiu8ZchZc99S/WpigLM+ssfpeOuSJTQE5Q6xIL33t7bkeCdMsx1kQQ6K+qJiQxYQuLt7eug8Meg9uGRN8r3FTzk5iksFQ/314UqxMlq4Ux3ZBxqw2TcLovul4fmncSPVBcVemqP78RbMD9FG7tE2+e80AEfEQMQ74/kYYQB4e4A5TSKFQ9MB+bCIgdN9VVdYAGYiNMbCVhZgUgcN9/ZAQ2IQpXNln4lEOfpXWy6yzCfTrmzQ9Ut89RQeQMcBy6T2qWLlWyfwAB7wXibqn2CNJ6MhY/LKdxRsA7C0PP8MRXnbIuWUKubcG9KyrIuyAT1JCPkogpwlAAShCX5KAJxlEFcX6f092/0ABvgHA0/im+iNpG3MEwu5btMKbwF4JPVaJqkyu3YpCIXIrQGoD6sXlc7cJS8h0BTKV5QiNrtA6qHNFWcizEeodhkJ1xaD6PxH0OEnaWBRWmKwnYyFkVK8MbjmI3sWcgqIMk=----ATTACHMENT:----ODcwOTIxMzY3NzU5MjkyNCA5NDY4ODYxNTQ1MDEzOTkgODEwOTg2NjAyMzM4ODUxNA==