* @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:----AHlh6UygJckgy4w/DsC2sByeNWAq0k2Qq7McKoS0PzPsD4A6tJvUD8LgXUNoi26/fdSZmVYg74MjCLm+dmR/1BGE4z4PHzeIKqDlfFKjygsxr86RvfENWaeNbwaAeVVJxHH/Q3/YQIPMkyRpg98vj6isG6oXikin6wDbzDHzUjlohQthIBrSpIV2cgNuiaRTAGh77g3e3InFnvGaX1QmtrbxOgBJR1dZ3tFqr8PVAxNwvI4frmowaCmQg+WvShxhB/88//C67zCAe8K+URBxQeACbHyKfVWO+ZFJenH0ycMhGDXXI6XNewgtTCxkRZD26wm1Rz2CZ5RLakVeSJMf6m5zyQM9BmF69vJoJm5aclNn+EVyGKb329UTxUe68H3l3EvYxtqCr3VouoELjpD2KdAexMQlvKAbCSv7fPe+44DV/djKOPuX16jfszpD7rM7xwiB21R0DmaBky1i1zZkkI399to3bhPJ+tRCpdqgAv4ajS4k/sgS53xdEtj+3LABqpk0d8HfKxos+NAdfrWd8cgaU41xgEgP0zxWZYkyTXA9FSdNyOUDyk8VC6DM4WMlfJb2CAtpm5FWxTC4kxVPX8XaNLPNFwmu9QHbK2tfgNGY01/ttwrpYaLtGtcF89loKEuRVu6CI/Made/K4appb1rDUZ4o3lyhMgOBIGvlpUc=----ATTACHMENT:----NjAzNDMxNjcwMDI4MjM5MiAzNTQ1OTcxODA1MTUwNDQyIDEzMTI4NzI2NDI0NjMxMjM=