| @@ 84-89 (lines=6) @@ | ||
| 81 | ||
| 82 | // check if any of the required keys is missing |
|
| 83 | foreach (array_keys($this->optionList) as $opt) { |
|
| 84 | if ($this->optionList[$opt][2]) { |
|
| 85 | // required |
|
| 86 | if (!array_key_exists($opt, $optionValues)) { |
|
| 87 | throw new CliException(sprintf('missing required parameter "--%s"', $opt)); |
|
| 88 | } |
|
| 89 | } |
|
| 90 | } |
|
| 91 | ||
| 92 | // check if any of the options that require a value has no value |
|
| @@ 96-101 (lines=6) @@ | ||
| 93 | foreach (array_keys($this->optionList) as $opt) { |
|
| 94 | if ($this->optionList[$opt][1]) { |
|
| 95 | // check if it is actually there |
|
| 96 | if (array_key_exists($opt, $optionValues)) { |
|
| 97 | // must have value |
|
| 98 | if (0 === count($optionValues[$opt])) { |
|
| 99 | throw new CliException(sprintf('missing required parameter value for option "--%s"', $opt)); |
|
| 100 | } |
|
| 101 | } |
|
| 102 | } |
|
| 103 | } |
|
| 104 | ||