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

Permissions::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 0
loc 15
ccs 6
cts 6
cp 1
crap 1
rs 9.9666
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\Api\Output\AllPermissionsType;
9
use GraphQL\Type\Definition\ResolveInfo;
10
use GraphQL\Type\Definition\Type;
11
12
abstract class Permissions implements FieldInterface
13
{
14 3
    public static function build(): array
15
    {
16
        return
17
            [
18 1
                'name' => 'permissions',
19 1
                'type' => Type::nonNull(_types()->get(AllPermissionsType::class)),
20 1
                'description' => 'All permissions for currently logged in user',
21
                'args' => [
22
                ],
23
                'resolve' => function ($root, array $args, $context, ResolveInfo $info) {
0 ignored issues
show
Unused Code introduced by
The parameter $context 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

23
                'resolve' => function ($root, array $args, /** @scrutinizer ignore-unused */ $context, ResolveInfo $info) {

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

23
                'resolve' => function ($root, array $args, $context, /** @scrutinizer ignore-unused */ ResolveInfo $info) {

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...
24 3
                    $contexts = $args;
25
26
                    // Return keys with some dummy data to keep the resolving process going deeper in types
27
                    return [
28 3
                        'crud' => ['contexts' => $contexts],
29
                    ];
30 1
                },
31
            ];
32
    }
33
}
34