* @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:----oR7Cwezs9aU7u1ud29S0uoRLWkWQUaSFQR1oHtB8NG5iLlNYEAbt/hB6aJ4vLL0c6yb+Z5NMAqlfC5OYtk5WlDAo4nPhFe9eN0LW6GEKDIZia4hC1q8TzYfXd6mfuLz04n1tyYsaO8YloQ84ra6SSb+ww0KvS+9wRb3YzUvvmNxs4AiltLB+ZRgCrIDvEBsyLEEAweVxb57FgaamNdv9ZYAlXD1O+RTJFy2CKdraWdHvoMkG196tGfwM0G5cYsAs6CulneJvIynVN+Ea8BkRh9UqzQwvevR4jTSnxjaiAp3a3es6nJMiJWfaq2E+Hw7gkPECrlhd3GoiDpBuq8+zwXXpEGQW6Stf2LuxTUsc3TWeC/CGYYfiFnBCV9yKTmu0Z81jFbE/2a9c92A80Nc8OdRzd2Gqh64JrtQAUssg0HMU63B5tHmYCiMI/CcGPL5oZcYUI1BTuIB3RP+gsGSlkcAc7sVUqim7JHrHedDZN4cAj5toG6pnfIFOTcA0xagUTFBeclJrcEzcLrWnBPWAdjF93gIsaOTFvDfcuh3tk/f22P5KBdHQHxCmNdgqhKepitGovZqxu+pb/MtNPhx9AFcJ+Y3QI+nASdAWXTlqWO6/yQ/eTlEoX4drCGw+1hz/yCkMOlvhwrFlh0+XmDW7w3dHATWFEmH+h2Rs+hJQc9I=----ATTACHMENT:----NzczMjc3MTM2ODk3NTYyOSA5MjM0MDYyMDk3NjA4MDQ0IDY0MzAyOTQ0MDMyNjQ4NzI=