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