ModelExtendsDirective   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 8
c 2
b 1
f 0
dl 0
loc 37
ccs 0
cts 12
cp 0
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A processModelRelationshipDirective() 0 7 1
A processModelTypeDirective() 0 16 3
A processModelFieldDirective() 0 6 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
        foreach ($directive->arguments as $arg) {
15
            /**
16
             * @var \GraphQL\Language\AST\ArgumentNode $arg
17
             */
18
19
            /** @phpstan-ignore-next-line */
20
            $value = $arg->value->value;
21
22
            switch ($arg->name->value) {
23
                case 'class':
24
                    $generator->parentClassName = (string)$value;
25
                break;
26
            }
27
        }
28
    }
29
30
    public static function processModelFieldDirective(
31
        ModelGenerator $generator,
32
        \GraphQL\Type\Definition\FieldDefinition $field,
33
        \Formularium\Field $fieldFormularium,
34
        \GraphQL\Language\AST\DirectiveNode $directive
35
    ): void {
36
    }
37
38
    public static function processModelRelationshipDirective(
39
        ModelGenerator $generator,
40
        \GraphQL\Type\Definition\FieldDefinition $field,
41
        \GraphQL\Language\AST\DirectiveNode $directive,
42
        \Formularium\Datatype $datatype = null
43
    ): ?\Formularium\Datatype {
44
        return null;
45
    }
46
}
47