@@ 315-322 (lines=8) @@ | ||
312 | * |
|
313 | * @throws MissingArgumentException if a required parameter is missing |
|
314 | */ |
|
315 | protected function validateRequiredParameters(array $required, array $params) |
|
316 | { |
|
317 | foreach ($required as $param) { |
|
318 | if (!isset($params[$param])) { |
|
319 | throw new MissingArgumentException(sprintf('The "%s" parameter is required.', $param)); |
|
320 | } |
|
321 | } |
|
322 | } |
|
323 | ||
324 | /** |
|
325 | * Validate allowed parameters array |
|
@@ 367-379 (lines=13) @@ | ||
364 | * |
|
365 | * @throws MissingArgumentException |
|
366 | */ |
|
367 | protected function validateAtLeastOneOf(array $atLeastOneOf, array $params) |
|
368 | { |
|
369 | foreach ($atLeastOneOf as $param) { |
|
370 | if (isset($params[$param])) { |
|
371 | return true; |
|
372 | } |
|
373 | } |
|
374 | ||
375 | throw new MissingArgumentException(sprintf( |
|
376 | 'You need to provide at least one of the following parameters "%s".', |
|
377 | implode('", "', $atLeastOneOf) |
|
378 | )); |
|
379 | } |
|
380 | ||
381 | /** |
|
382 | * Remove our fields that don't need to be passed to Trello. |