processModelFieldDirective()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 1
eloc 0
c 2
b 1
f 0
nc 1
nop 4
dl 0
loc 6
ccs 0
cts 1
cp 0
crap 2
rs 10
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