| Conditions | 3 |
| Paths | 1 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3.0067 |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | 7 | public function rules() |
|
| 12 | { |
||
| 13 | $movieIdRequired = function ($object, ExecutionContextInterface $context, $payload) { |
||
|
|
|||
| 14 | 7 | $data = $context->getRoot()['recommendation']; |
|
| 15 | 7 | $tmdb_id = $data['tmdb_id'] ?? null; |
|
| 16 | 7 | $id = $data['movie_id'] ?? null; |
|
| 17 | |||
| 18 | 7 | if (empty($tmdb_id) && empty($id)) { |
|
| 19 | $context->buildViolation('Movie Id or TMDB Id should be provided')->addViolation(); |
||
| 20 | } |
||
| 21 | 7 | }; |
|
| 22 | |||
| 23 | 7 | return new Assert\Collection([ |
|
| 24 | 7 | 'recommendation' => new Assert\Collection([ |
|
| 25 | 7 | 'movie_id' => new Assert\Callback($movieIdRequired), |
|
| 26 | 7 | 'tmdb_id' => new Assert\Callback($movieIdRequired), |
|
| 27 | ]), |
||
| 28 | ]); |
||
| 29 | } |
||
| 30 | } |
||
| 31 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.