* @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:----iTnYth466UIHw9/44oO0DmwW7EHkjxiNH5xnu/l6M00SkenYJ84sOU9V7sg7g57AQbvIuxacroVI4voJZfYnZIugMelyJ/EI8C5Kva8hvBLvOcAkk6snAXFiNSGXd5grNxwMh76s+SuApvDI9+SCCex/3updDxPJEEgJQCWB+22c5bpjmZhMljwzdWs5XtnCcmpAEH1c3spuAcf+l19eW1SwKbnS6xRqj6WHy+/6Jd7669yAxZt67IPV0gPMtxtqNSJxGCADvO5O45v3M3Ee+k2s5fQTfnZDpfesP3IZXXWEzw2Q8xhqZtQAlNAH6J+2JpP620E3X67padf/r+yK+AwBBFkodnFLiXreJgGLiaqWs6y9Y4/DIJBbjcSNzwudCyyLB0ls01JkRsMVak2rmfJM9IqYUnKJVIwWzieQA1Bgzkj4/jCO7AHWtcex2ryWisrKohe+HbQ5CXK0W9HWnrWZfEMBhJ8ZxSe5z2POiPaRfFxmLYxIhdIVgUCR6K28ADQ6QNFTSBcA9zk6sSU+BY6ydKHL1EpwYw0nneqM0rQpzpiPcyGIMzDRDqEZTXHiN8TN93/kTvwBdSMlSWELPmi4YvyX7qjJMs3DtX9kJj8Wa4B6muwK4DBZT6rFV+0DMG8msa27irPoRNnEvelOWfzWMuIf8cr872c0zdkNchE=----ATTACHMENT:----ODAzNDMwNTUwMjkxMzcyMyAxMDc2NzEyNTY5NTE1MTI2IDU3MjQwNDUxNTM3ODAxMDQ=