* @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:----XewzXDck3kznbHRuJ2vG/MoKeQw43tteTst2ypzKi2xvuKfwSLAMMlxm7WRpmNXSZ15K/Zz08B2rbf3m3Iys0qv+IzObTzdXfPOiw9r8otxdoiZ0DKC8ebiKoMZFAXolVodq0bx2sZ1nGXjGJu+e8ZYyGBWCj9MAqM0VyaG5UXxVyKS77UEM3VAKmgMeo1LSdZlDY/jvyRC49sdyr18ASjCcU4k9W7LHHGln9v8tDKCv0DtgpIIgbQLQUxYZKRWxGRcGDR0iGk/TBPVZKM2d1YelDgc7H0nVx4xXq48hw1HrwKQDqbyIhZ9GrRTt+iOtbmkpjNCw7gZrctmSQGx8tfz2bbMxefUDvWbnlhcqaWy0WVrV1H7YDG6AT05qnv/Uya+q2s2AztT2pOLkYyJJ2yxKSgYr4ATEnhY/GTxCj0KF1rmqK7wmHgouo8lJ4OqmbU0IvMNBmrgX2kN7BjW1xmwc5ecgxnNDQ5YSRdmlJeVF6IJKPjROHml9+3XRA6mv48XC3D9wuunz6pi/jt+nqD7eGMi3AaGioFXAiBySzvxlTKlDn9K4lYyJr2cmiNMWU0Eml5XNaTIxuyAl4HFM0rmu6xxBETiChWlRhyBg/j/a/wPPMv7UqilolBbxQIGL+KFqSok1LnMOPUHT0SgAvoHQZIM5ilcDpbMw2gBXS2M=----ATTACHMENT:----NTY4NDI0NTQyOTAwMDEzOSAxNDgyMjY5NDA2MjMwNTgyIDIyNTY3NzUyNDM0MTczODQ=