* @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:----QPNz1o/ivRdUE/TFznjVyfIejwYGcTNSGZYxZs0aYh/DR4x6gok2RRCCPjdU+7pCBwjZufvcxQW9hmdxO+k7GjcTi8ro4s17Ti0QNWqAGxROZMUOa4yArdJpVxnqW94csOBkGvN+5116Qg22S4fMZeXwmYZvxIcqHpQiLKGxdth/s3HcdMTMWGHll0XiAdn132Y5q7hmNoas47Fi7ebqSW4Q008hOO7Mm20irj+bEtRguseTfpaSjD7727cU6eMSEekTenF9mfH4QCJEn35Vg1s+41ILrRn/izfoomvt+Rh0a1pzMWUxQS9INXNUkIbNrGojqxLMw9CrLgc2djXm0HWHHbAQHNpAU2nN5ThvKjn3F899J6HIzWW7uK3g+QphuM539h8OO6EhlQO4aZmrKYJVi/GRJWPjaSRp5diApvUBGuVSxo0KW//M3vQlEazPczUxbhxSDsiV+EeDGAI62oRH0PcSty5HZpPls2TOjLuWXTyRj8YozjwKk6U/9V92OgT65Q98ChKePAC6C/0bWdMTdjzIkZD9y5CZv85ifmT1JV5jR9cHpyaiLLKJ/DtxNa+rWdjsQhIieKL5e4Y1XXiRRyThBPQ1sfmy+2pCqdNBEP9/leAvbBlwN44Nc8H+n59ATniTxiQolHg+WbLYZRVKIfdqRmhpwDMDchw9mqI=----ATTACHMENT:----NzUxMjYyNDMxOTE4MzUzNCAxNzIyOTE5OTE5NzQ3MTkwIDQ2NjA1MzM1MzEzNTQ4Mjk=