Completed
Pull Request — 8.x-3.x (#401)
by Sebastian
02:30
created

SchemaBuilderFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addPluginManager() 0 3 1
A getSchemaBuilder() 0 4 1
1
<?php
2
3
namespace Drupal\graphql\Plugin\GraphQL;
4
5
use Drupal\Component\Plugin\PluginManagerInterface;
6
7
class SchemaBuilderFactory {
8
9
  /**
10
   * List of registered plugin managers.
11
   *
12
   * @var \Drupal\Component\Plugin\PluginManagerInterface[]
13
   */
14
  protected $pluginManagers = [];
15
16
  /**
17
   * {@inheritdoc}
18
   */
19
  public function addPluginManager(PluginManagerInterface $pluginManager) {
20
    $this->pluginManagers[] = $pluginManager;
21
  }
22
23
  /**
24
   * Retrieve a schema builder instance.
25
   *
26
   * @param null $schemaReducer
27
   *   Schema reducer to apply to the schema.
28
   *
29
   * @return \Drupal\graphql\Plugin\GraphQL\SchemaBuilder The schema builder.
30
   *   The schema builder.
31
   */
32
  public function getSchemaBuilder($schemaReducer = NULL) {
33
    // TODO: Implement schema reducer logic.
34
    return new SchemaBuilder($this->pluginManagers, $schemaReducer);
0 ignored issues
show
Unused Code introduced by
The call to SchemaBuilder::__construct() has too many arguments starting with $schemaReducer.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
35
  }
36
37
}
38