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

RenderableDirective   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 5
c 1
b 0
f 0
dl 0
loc 29
ccs 0
cts 9
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A processModelFieldDirective() 0 13 2
A processModelTypeDirective() 0 4 1
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 RenderableDirective 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
            $argName = $arg->name->value;
27
            $argValue = $arg->value->value; /** @phpstan-ignore-line */
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...
28
            $generator->fModel->appendRenderable($argName, $argValue);
0 ignored issues
show
Bug introduced by
The method appendRenderable() does not exist on Formularium\Model. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
            $generator->fModel->/** @scrutinizer ignore-call */ 
29
                                appendRenderable($argName, $argValue);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
29
        }
30
    }
31
32
    public function processModelRelationshipDirective(
33
        ModelGenerator $generator,
34
        \GraphQL\Type\Definition\FieldDefinition $field,
35
        \GraphQL\Language\AST\DirectiveNode $directive
36
    ): void {
37
    }
38
}
39