Passed
Push — master ( a41166...4c99b3 )
by Bruno
03:13
created

ModelExtendsDirective   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 7
c 1
b 0
f 0
dl 0
loc 33
ccs 0
cts 11
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A processModelTypeDirective() 0 4 1
A processModelFieldDirective() 0 16 3
A processModelRelationshipDirective() 0 5 1
1
<?php declare(strict_types=1);
2
3
namespace Modelarium\Laravel\Directives;
4
5
use Modelarium\Laravel\Targets\ModelGenerator;
6
use Modelarium\Laravel\Targets\Interfaces\ModelDirectiveInterface;
7
8
class ModelExtendsDirective implements ModelDirectiveInterface
9
{
10
    public static function processModelTypeDirective(
11
        ModelGenerator $generator,
12
        \GraphQL\Language\AST\DirectiveNode $directive
13
    ): void {
14
    }
15
16
    public static function processModelFieldDirective(
17
        ModelGenerator $generator,
18
        \GraphQL\Type\Definition\FieldDefinition $field,
19
        \GraphQL\Language\AST\DirectiveNode $directive
20
    ): void {
21
        foreach ($directive->arguments as $arg) {
22
            /**
23
             * @var \GraphQL\Language\AST\ArgumentNode $arg
24
             */
25
26
            $value = $arg->value->value;
0 ignored issues
show
Bug introduced by
Accessing value on the interface GraphQL\Language\AST\ValueNode suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
27
28
            switch ($arg->name->value) {
29
                case 'class':
30
                    $generator->parentClassName = $value;
31
                break;
32
            }
33
        }
34
    }
35
36
    public function processModelRelationshipDirective(
37
        ModelGenerator $generator,
38
        \GraphQL\Type\Definition\FieldDefinition $field,
39
        \GraphQL\Language\AST\DirectiveNode $directive
40
    ): void {
41
    }
42
}
43