* @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:----B9KvOkfrPmHxmSSwbqI5cGN0i6j3UoPAAKsNcJC/dVkCjXUoNVXm1S8T/2XHC/884nKM//6uuLYVz1X4OCErwfOzy76D5rcVUQjEVWgkI9HsAL4jgYzNmEqNO1Xx3QdoVEvp47/4HfqoRSXOrLfxVH4te7iaike0oTX/5Id72YLolgYc5QsuNMIrsVN77AS9C2h8p/aOhOa1ddsypsDPjKuYI8ToaA+5pXL6Fp4BZlU2loT9Fb4wSAka+Oly2Wl322l3+DwrW8pFW4SEI1kLd3YJEEDoe1Mp3NCeqjnnxs5yIcRGZObMUU0buXqo0E+Xh0ph42uBEGKuY/si7Nx20KGsYKaskPFXeRBSiIobrlfuMe0n8Ms4Ol1zg/RolCZ2sq06y9/TeD+IAn2eawm4y2jgWP2cmxKrHSOZcA9zzlrup69nDg4dyhsBRRI7rhE5d5cYqh07pZMxRlNWl2QdywV38RlVZI18giF1SyeqHo93Z8D9wjZYegE2ESiSDZ0e0dLoTR7bNPv55xFSJWRlJD8Y5ENmIkzOWEoBmxjn1u4IOYDTo/MUCLsNmnQ23j9op4OBSs4X5kIOZaoLWRKoJJfRMvoK3v3NrnTsf7Z/GdcmBCwk9ckB3gP16nkePbSVzmt98x8FxQj0uFalYDM89iOFKWhWrc7XNMuw0KTqbk8=----ATTACHMENT:----NDQzOTc2OTIxMjMzNDc3NSA5ODM1ODQ0NjQ2NzYwMjYzIDk5MzY3ODMwODM0ODg2MjQ=