| @@ 164-170 (lines=7) @@ | ||
| 161 | */ |
|
| 162 | public function add($cmd, $keys = null, $argv = null) |
|
| 163 | { |
|
| 164 | if ($keys !== null) { |
|
| 165 | if (is_scalar($keys)) { |
|
| 166 | $keys = [(string)$keys]; |
|
| 167 | } elseif (!is_array($keys)) { |
|
| 168 | throw new \Exception("Keys must be an array or scalar"); |
|
| 169 | } |
|
| 170 | } |
|
| 171 | if ($argv !== null) { |
|
| 172 | if (is_scalar($argv)) { |
|
| 173 | $argv = [(string)$argv]; |
|
| @@ 171-177 (lines=7) @@ | ||
| 168 | throw new \Exception("Keys must be an array or scalar"); |
|
| 169 | } |
|
| 170 | } |
|
| 171 | if ($argv !== null) { |
|
| 172 | if (is_scalar($argv)) { |
|
| 173 | $argv = [(string)$argv]; |
|
| 174 | } elseif (!is_array($argv)) { |
|
| 175 | throw new \Exception("Argv must be an array or scalar"); |
|
| 176 | } |
|
| 177 | } |
|
| 178 | ||
| 179 | $this->cachedParams = false; |
|
| 180 | $this->stack[] = [$cmd, $keys, $argv]; |
|