Completed
Push — master ( 3b66c0...5eff18 )
by Sylvain
14:13
created

NextAccountCode   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 15
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 0 13 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Api\Field\Query;
6
7
use Application\Api\Field\FieldInterface;
8
use Application\Model\Account;
9
use GraphQL\Type\Definition\Type;
10
11
abstract class NextAccountCode implements FieldInterface
12
{
13
    public static function build(): array
14
    {
15
        return
16
            [
17
                'name' => 'nextAccountCode',
18
                'type' => Type::nonNull(Type::int()),
19
                'description' => 'Next available account code for creation',
20
                'args' => [],
21
                'resolve' => function ($root, array $args): int {
2 ignored issues
show
Unused Code introduced by
The parameter $root is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

21
                'resolve' => function (/** @scrutinizer ignore-unused */ $root, array $args): int {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $args is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

21
                'resolve' => function ($root, /** @scrutinizer ignore-unused */ array $args): int {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
22
                    /** @var AccountRepository $repository */
23
                    $repository = _em()->getRepository(Account::class);
24
25
                    return $repository->getNextCodeAvailable();
26
                },
27
            ];
28
    }
29
}
30