Passed
Push — master ( 95d3b3...37ba81 )
by Adrien
07:02
created

Viewer::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1.008

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 9
ccs 4
cts 5
cp 0.8
crap 1.008
rs 10
c 0
b 0
f 0
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\User;
9
10
abstract class Viewer implements FieldInterface
11
{
12 1
    public static function build(): array
13
    {
14
        return
15
            [
16 1
                'name' => 'viewer',
17 1
                'type' => _types()->getOutput(User::class),
18 1
                'description' => 'Represents currently logged-in user',
19
                'resolve' => function ($root, array $args): ?User {
2 ignored issues
show
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

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

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 $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

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

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...
20
                    return User::getCurrent();
21 1
                },
22
            ];
23
    }
24
}
25