| Conditions | 6 |
| Paths | 3 |
| Total Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public static function validate(array $resource): array |
||
| 22 | { |
||
| 23 | if ($resource['data']['type'] === EndpointInterface::TYPE_SOURCE && (!is_array($resource['data']['options']['import']) || count($resource['data']['options']['import']) === 0)) { |
||
| 24 | throw new InvalidArgumentException('source endpoint must include at least one options.import attribute'); |
||
| 25 | } |
||
| 26 | |||
| 27 | if ($resource['data']['type'] === EndpointInterface::TYPE_DESTINATION && !isset($resource['data']['options']['filter_one'])) { |
||
| 28 | throw new InvalidArgumentException('destintation endpoint must have single object filter options.filter_one as a string'); |
||
| 29 | } |
||
| 30 | |||
| 31 | return $resource; |
||
| 32 | } |
||
| 33 | } |
||
| 34 |