* @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:----xhSisOB+1bPDETFYHR7W9yL80J1+Y0VUZoxjr30V+sjPK1mjQUcrRmz+EhbMsf3O3edIO3iDEb0voNF6qZWfFmhOPpperS4dVxlAuXkJF2CWP/226yr6/ToBeXK8dhOyooGj8Kp5PLuMZS12sP4xT0NP+MBCCsS4/aaDqYGgTeFErIQMBnHy9EGw5nwBKq28stbnryNRGMifPVkNYsrTqs8XweKOfa+z0OVvngm0ckMxYPLuHTz6CP6S1rXvoGD9pki2LvT2xPuxaXEMj3EDfo2OExSE23osoe/D8ljkFYHOhELkZ4BYROCGi5a8c0+u/qwrlswrFTd+unAmNJ9O7aV99wVi1ALk8ZvzuaTtRrpe62cZTldhsuhBqBUvQW+hLy58hyxCAHTNhtySW8WbYMO5Y2rJuxykQwXxCcSCfLdUe0qZ3u99Kgw0yjvAZcArS755vDPLh4hCtDnmqzIMe7z+ubvx3JFh0f5BvbPjjKtlO/4WXZLMH4gv5mj9TsYhrWXJtGG6y578lBJ3dGnexAN/IUA/IQz37QfE3D/Fcsymvqi7/mmFJoX2ppTirlljvkL4ZcFq+321HuFLUzNTm/nK7imf14gQ1KOA0AiLbx4ep+ETmrsTi82A5Jb/DYgFhMTMI2HD7woyqakW/qtjAyyVrnTmQkNBbk9i8RcIn3w=----ATTACHMENT:----Mjc2NDcwNzEyNzc4Njk0MiA5NTQ2MzU1OTY3Njk5NDk2IDY1MjcyMjA3MjQxMTQyNDQ=