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

SchemaScaffolderExtension::onBeforeAddToManager()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 1
dl 0
loc 14
rs 9.9666
c 0
b 0
f 0
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