| @@ 103-108 (lines=6) @@ | ||
| 100 | ||
| 101 | // check if any of the required keys is missing |
|
| 102 | foreach (array_keys($this->optionList) as $opt) { |
|
| 103 | if ($this->optionList[$opt][2]) { |
|
| 104 | // required |
|
| 105 | if (!array_key_exists($opt, $optionValues)) { |
|
| 106 | throw new CliException(sprintf('missing required parameter "--%s"', $opt)); |
|
| 107 | } |
|
| 108 | } |
|
| 109 | } |
|
| 110 | ||
| 111 | // check if any of the options that require a value has no value |
|
| @@ 115-120 (lines=6) @@ | ||
| 112 | foreach (array_keys($this->optionList) as $opt) { |
|
| 113 | if ($this->optionList[$opt][1]) { |
|
| 114 | // check if it is actually there |
|
| 115 | if (array_key_exists($opt, $optionValues)) { |
|
| 116 | // must have value |
|
| 117 | if (0 === count($optionValues[$opt])) { |
|
| 118 | throw new CliException(sprintf('missing required parameter value for option "--%s"', $opt)); |
|
| 119 | } |
|
| 120 | } |
|
| 121 | } |
|
| 122 | } |
|
| 123 | ||