| Conditions | 5 |
| Paths | 8 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | 3 | public function validate(ExecutionContextInterface $context) |
|
| 21 | { |
||
| 22 | 3 | if (empty($this->links)) { |
|
| 23 | 1 | $context->buildViolation('Parameter is mandatory: links.')->addViolation(); |
|
| 24 | } |
||
| 25 | |||
| 26 | 3 | if (!is_array($this->links)) { |
|
| 27 | 1 | $context->buildViolation('Links must be an array.')->addViolation(); |
|
| 28 | } else { |
||
| 29 | 2 | foreach ($this->links as $linkKey => $link) { |
|
| 30 | 2 | $url = $link['url'] ?? null; |
|
| 31 | |||
| 32 | 2 | if (!$url) { |
|
| 33 | 2 | $context->buildViolation(sprintf('Parameter is mandatory: links[%s][url].', $linkKey))->addViolation(); |
|
| 34 | } |
||
| 35 | } |
||
| 36 | } |
||
| 37 | 3 | } |
|
| 38 | } |
||
| 39 |