* @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:----XDI4SYqCKXexc61tpcAnjMwI2fCn2j5HX6cGa9iSpeU2yH8dpqE59HhHzu+Xpxk9XQToWWhVkpP5Gmv7Lo1GR2JwCZJC9RYIxlp7G3egZMweqWWs9t3f3JnY0xPtqfd+3mLmx2BIq91J2rRYrAV+yAKvJ+K3ZCYsPTbt4PpXTsWTgDxcdyUFtXRrSII768dhKyk8S+di55FapjFmI9Q17gG+5lO1mvhhRSRyVJBrEN24tn4OBr95Ia3x7klwRVHmrWdh3LFRPzUHkkt121P9XVE1l1OVqqqos74awsCykQFs7z5dZU8zHqKbXQ5GHLMM6R/DUm09LWM0JobFBGcrc4K33tlVsEz3D3Mw/HVbU5Q1+e2MtQPfr9bYXuCPGmmLeFGhJ8yYH+//EryHoekOXyVga3MJ8RA738+xEfOsutwueQo6ertxM5SyAU8iVzGIEVrTBBQYFlWknwxqcOH7u7PAHVpBGLE2O++spUIUR0bJ04XzjrSN/VGsnjWdu/SHvPJGls7YzfuuKmQT2rU8d8ttz9rZHyTJ+xbBklfHKV+V1uIp1kjD35kRf2jwBrDLfEr8p043AKEqQ3f9BAku1S3cXcvwCWxoT0DAcwbrHPVPFl0iH9fIU05T4hvq/XUI3mUA28u0mAUnvjZitYzM7akxQjS3XupH0EFZwShFhro=----ATTACHMENT:----OTIwMDEzOTAzMjU4NjUxIDkyMDI3MzQyNDg3MTg1MzggNzQzNzIwMDE0NTIzMjE1Nw==