Conditions | 2 |
Paths | 1 |
Total Lines | 28 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 16 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
16 | 2 | public static function build(): array |
|
17 | { |
||
18 | return [ |
||
19 | 1 | 'name' => 'updateTransaction', |
|
20 | 1 | 'type' => Type::nonNull(_types()->getOutput(Transaction::class)), |
|
21 | 1 | 'description' => 'Update a transaction, and optionally replace all its transaction lines if given any', |
|
22 | 'args' => [ |
||
23 | 1 | 'id' => Type::nonNull(_types()->getId(Transaction::class)), |
|
24 | 1 | 'input' => Type::nonNull(_types()->getPartialInput(Transaction::class)), |
|
25 | 1 | 'lines' => Type::listOf(Type::nonNull(_types()->getInput(TransactionLine::class))), |
|
26 | ], |
||
27 | 'resolve' => function ($root, array $args, SessionInterface $session): Transaction { |
||
1 ignored issue
–
show
|
|||
28 | // Do it |
||
29 | 2 | $transaction = $args['id']->getEntity(); |
|
30 | 2 | $input = $args['input']; |
|
31 | 2 | Helper::hydrate($transaction, $input); |
|
32 | |||
33 | // Check ACL |
||
34 | 2 | Helper::throwIfDenied($transaction, 'update'); |
|
35 | 2 | $lines = $args['lines']; |
|
36 | |||
37 | 2 | if ($lines !== null) { |
|
38 | 1 | _em()->getRepository(Transaction::class)->hydrateLinesAndFlush($transaction, $lines); |
|
39 | } else { |
||
40 | 1 | _em()->flush(); |
|
41 | } |
||
42 | |||
43 | 2 | return $transaction; |
|
44 | 1 | }, |
|
48 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.