* @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:----ozYKOW/xsdbbHJK1Yj34uwcvctl7ZGTvL1Fi4f/nsPUVDevtZUJXsoCVYohDCQxIpQr6DeofjsiVqlL0p30ZS+shtM8xC0EPNDyBxNvpWEb9lFjgNJ2lOHR/WgZiCP02TYQkHqMYyat6kJJIVfc0xKbdmH4V8+W6ZqzaWbZDLZegAJKGdYGqlY6pm2AnGXQ2wNqvqcMwdW0+jJweYSHIVpgSZqS8UwqzheUjvRd1pt2vy1G9zVmcPEFHeYZwT9NFJQ1wbOmVKcuy8g/xxmmQUf1p66zSeGyhK8TtI+/PNs09WJtDny3QU9925+6Ive/dPzxMiv2VB3L98DE7YSnw+PPjJfnmDz4EtXfetCrfq7Z4xtuJmBOj6hkCDudR1IgaVlKgXEl184efb7ivAvbpf3QFeYq7f/WRYd/L4HwP3Y7x4V6y2cdK09oa5mq2nisENYQc5N0P9j5Nc/87HQikNlFfQwtgkcoCTplxTkJ2efiiBhZZZ2m1FbXOh0KoLAKhtc5TpQY6V5rF0/FchCyVuqtH5X2BSPF6DILl9HqfxdVrpZ/jrXZoNUmK04w8EIJPDgwxmhxs3KsPsC6ru6vjfcn9y5p/x/pCFNg+Fp/Z2Vqvpw8Zj/OZ+w6fssXkhCAl3kWIw2LX340xVLLJmyvlGw1kbXwZgvvFi/O3HNnxkP4=----ATTACHMENT:----NTcwNTkwMjc2OTc1MzE3MCA1ODczNDI3MDM4MDU1Nzc5IDkxMTQwMDAyMzc2NDQxOTM=