Completed
Pull Request — master (#165)
by Christoffer
03:04
created

SchemaBuilder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 34
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 15 1
A __construct() 0 3 1
1
<?php
2
3
namespace Digia\GraphQL\SchemaBuilder;
4
5
use Digia\GraphQL\Error\LanguageException;
6
use Digia\GraphQL\Language\Node\DirectiveDefinitionNode;
7
use Digia\GraphQL\Language\Node\DocumentNode;
8
use Digia\GraphQL\Language\Node\NamedTypeNode;
9
use Digia\GraphQL\Language\Node\SchemaDefinitionNode;
10
use Digia\GraphQL\Language\Node\TypeDefinitionNodeInterface;
11
use Digia\GraphQL\Language\Node\TypeNodeInterface;
12
use Digia\GraphQL\Type\Definition\DirectiveInterface;
13
use Digia\GraphQL\Type\SchemaInterface;
0 ignored issues
show
Bug introduced by
The type Digia\GraphQL\Type\SchemaInterface 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...
14
use function Digia\GraphQL\Type\newGraphQLSchema;
15
use function Digia\GraphQL\Util\arraySome;
16
17
class SchemaBuilder implements SchemaBuilderInterface
0 ignored issues
show
Bug introduced by
The type Digia\GraphQL\SchemaBuilder\SchemaBuilderInterface 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...
18
{
19
    /**
20
     * @var BuilderContextCreatorInterface
0 ignored issues
show
Bug introduced by
The type Digia\GraphQL\SchemaBuil...ContextCreatorInterface 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...
21
     */
22
    protected $contextCreator;
23
24
    /**
25
     * SchemaBuilder constructor.
26
     * @param BuilderContextCreatorInterface $contextCreator
27
     */
28
    public function __construct(BuilderContextCreatorInterface $contextCreator)
29
    {
30
        $this->contextCreator = $contextCreator;
31
    }
32
33
    /**
34
     * @inheritdoc
35
     */
36
    public function build(
37
        DocumentNode $document,
38
        ResolverRegistryInterface $resolverRegistry,
0 ignored issues
show
Bug introduced by
The type Digia\GraphQL\SchemaBuil...solverRegistryInterface 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...
39
        array $options = []
40
    ): SchemaInterface {
41
        $context = $this->contextCreator->create($document, $resolverRegistry);
42
43
        return newGraphQLSchema([
0 ignored issues
show
Bug Best Practice introduced by
The expression return newGraphQLSchema(...ssumeValid'] ?? false)) returns the type Digia\GraphQL\Schema\Schema which is incompatible with the type-hinted return Digia\GraphQL\Type\SchemaInterface.
Loading history...
44
            'query'        => $context->buildQueryType(),
45
            'mutation'     => $context->buildMutationType(),
46
            'subscription' => $context->buildSubscriptionType(),
47
            'types'        => $context->buildTypes(),
48
            'directives'   => $context->buildDirectives(),
49
            'astNode'      => $context->getSchemaDefinition(),
50
            'assumeValid'  => $options['assumeValid'] ?? false,
51
        ]);
52
    }
53
}
54