| @@ 272-291 (lines=20) @@ | ||
| 269 | * @throws NoSuchOptionException If the command option with the given name |
|
| 270 | * does not not exist. |
|
| 271 | */ |
|
| 272 | public function getCommandOption($name, $includeBase = true) |
|
| 273 | { |
|
| 274 | Assert::string($name, 'The option name must be a string or an integer. Got: %s'); |
|
| 275 | Assert::notEmpty($name, 'The option name must not be empty.'); |
|
| 276 | Assert::boolean($includeBase, 'The parameter $includeBase must be a boolean. Got: %s'); |
|
| 277 | ||
| 278 | if (isset($this->commandOptions[$name])) { |
|
| 279 | return $this->commandOptions[$name]; |
|
| 280 | } |
|
| 281 | ||
| 282 | if (isset($this->commandOptionsByShortName[$name])) { |
|
| 283 | return $this->commandOptionsByShortName[$name]; |
|
| 284 | } |
|
| 285 | ||
| 286 | if ($includeBase && $this->baseFormat) { |
|
| 287 | return $this->baseFormat->getCommandOption($name); |
|
| 288 | } |
|
| 289 | ||
| 290 | throw NoSuchOptionException::forOptionName($name); |
|
| 291 | } |
|
| 292 | ||
| 293 | /** |
|
| 294 | * Returns all command options of the format. |
|
| @@ 619-638 (lines=20) @@ | ||
| 616 | * @throws NoSuchOptionException If the option with the given name does not |
|
| 617 | * not exist. |
|
| 618 | */ |
|
| 619 | public function getOption($name, $includeBase = true) |
|
| 620 | { |
|
| 621 | Assert::string($name, 'The option name must be a string or an integer. Got: %s'); |
|
| 622 | Assert::notEmpty($name, 'The option name must not be empty.'); |
|
| 623 | Assert::boolean($includeBase, 'The parameter $includeBase must be a boolean. Got: %s'); |
|
| 624 | ||
| 625 | if (isset($this->options[$name])) { |
|
| 626 | return $this->options[$name]; |
|
| 627 | } |
|
| 628 | ||
| 629 | if (isset($this->optionsByShortName[$name])) { |
|
| 630 | return $this->optionsByShortName[$name]; |
|
| 631 | } |
|
| 632 | ||
| 633 | if ($includeBase && $this->baseFormat) { |
|
| 634 | return $this->baseFormat->getOption($name); |
|
| 635 | } |
|
| 636 | ||
| 637 | throw NoSuchOptionException::forOptionName($name); |
|
| 638 | } |
|
| 639 | ||
| 640 | /** |
|
| 641 | * Returns all options of the format. |
|
| @@ 390-409 (lines=20) @@ | ||
| 387 | * @throws NoSuchOptionException If the command option with the given name |
|
| 388 | * does not not exist. |
|
| 389 | */ |
|
| 390 | public function getCommandOption($name, $includeBase = true) |
|
| 391 | { |
|
| 392 | Assert::string($name, 'The option name must be a string. Got: %s'); |
|
| 393 | Assert::notEmpty($name, 'The option name must not be empty.'); |
|
| 394 | Assert::boolean($includeBase, 'The parameter $includeBase must be a boolean. Got: %s'); |
|
| 395 | ||
| 396 | if (isset($this->commandOptions[$name])) { |
|
| 397 | return $this->commandOptions[$name]; |
|
| 398 | } |
|
| 399 | ||
| 400 | if (isset($this->commandOptionsByShortName[$name])) { |
|
| 401 | return $this->commandOptionsByShortName[$name]; |
|
| 402 | } |
|
| 403 | ||
| 404 | if ($includeBase && $this->baseFormat) { |
|
| 405 | return $this->baseFormat->getCommandOption($name); |
|
| 406 | } |
|
| 407 | ||
| 408 | throw NoSuchOptionException::forOptionName($name); |
|
| 409 | } |
|
| 410 | ||
| 411 | /** |
|
| 412 | * Returns all command options added to the builder. |
|
| @@ 860-879 (lines=20) @@ | ||
| 857 | * @throws NoSuchOptionException If the option with the given name does not |
|
| 858 | * not exist. |
|
| 859 | */ |
|
| 860 | public function getOption($name, $includeBase = true) |
|
| 861 | { |
|
| 862 | Assert::string($name, 'The option name must be a string. Got: %s'); |
|
| 863 | Assert::notEmpty($name, 'The option name must not be empty.'); |
|
| 864 | Assert::boolean($includeBase, 'The parameter $includeBase must be a boolean. Got: %s'); |
|
| 865 | ||
| 866 | if (isset($this->options[$name])) { |
|
| 867 | return $this->options[$name]; |
|
| 868 | } |
|
| 869 | ||
| 870 | if (isset($this->optionsByShortName[$name])) { |
|
| 871 | return $this->optionsByShortName[$name]; |
|
| 872 | } |
|
| 873 | ||
| 874 | if ($includeBase && $this->baseFormat) { |
|
| 875 | return $this->baseFormat->getOption($name); |
|
| 876 | } |
|
| 877 | ||
| 878 | throw NoSuchOptionException::forOptionName($name); |
|
| 879 | } |
|
| 880 | ||
| 881 | /** |
|
| 882 | * Returns all options added to the builder. |
|