Passed
Pull Request — master (#284)
by
unknown
02:22
created

SchemaScaffolderExtension   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A onBeforeAddToManager() 0 14 1
1
<?php
2
namespace DNADesign\Elemental\Extensions;
3
4
use GraphQL\Type\Definition\CustomScalarType;
0 ignored issues
show
Bug introduced by
The type GraphQL\Type\Definition\CustomScalarType was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
5
use SilverStripe\Core\Extension;
6
use SilverStripe\GraphQL\Manager;
0 ignored issues
show
Bug introduced by
The type SilverStripe\GraphQL\Manager was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
class SchemaScaffolderExtension extends Extension
9
{
10
    public function onBeforeAddToManager(Manager $manager)
11
    {
12
        $manager->addType(new CustomScalarType([
13
            'name' => 'ObjectType',
14
            'serialize' => function ($value) {
15
                return (object) $value;
16
            },
17
            'parseValue' => function ($value) {
18
                return (array) $value;
19
            },
20
            'parseLiteral' => function ($ast) {
21
                return $ast->value;
22
            },
23
        ]), 'ObjectType');
24
    }
25
}
26