Code Duplication    Length = 21-21 lines in 2 locations

src/Plugin/GraphQL/Fields/FieldPluginBase.php 1 location

@@ 39-59 (lines=21) @@
36
  /**
37
   * {@inheritdoc}
38
   */
39
  public function getDefinition(PluggableSchemaBuilderInterface $schemaBuilder) {
40
    if (!isset($this->definition)) {
41
      $definition = $this->getPluginDefinition();
42
43
      if ($type = $this->buildType($schemaBuilder)) {
44
        $this->definition = new Field($this, $schemaBuilder, [
45
          'name' => $this->buildName(),
46
          'description' => $this->buildDescription(),
47
          'type' => $type,
48
          'isDeprecated' => !empty($definition['deprecated']),
49
          'deprecationReason' => !empty($definition['deprecated']) ? !empty($definition['deprecated']) : '',
50
        ]);
51
52
        if ($args = $this->buildArguments($schemaBuilder)) {
53
          $this->definition->addArguments($args);
54
        }
55
      }
56
    }
57
58
    return $this->definition;
59
  }
60
61
  /**
62
   * {@inheritdoc}

src/Plugin/GraphQL/Mutations/MutationPluginBase.php 1 location

@@ 32-52 (lines=21) @@
29
  /**
30
   * {@inheritdoc}
31
   */
32
  public function getDefinition(PluggableSchemaBuilderInterface $schemaBuilder) {
33
    if (!isset($this->definition)) {
34
      $definition = $this->getPluginDefinition();
35
36
      if ($type = $this->buildType($schemaBuilder)) {
37
        $this->definition = new Field($this, $schemaBuilder, [
38
          'name' => $this->buildName(),
39
          'description' => $this->buildDescription(),
40
          'type' => $type,
41
          'isDeprecated' => !empty($definition['deprecated']),
42
          'deprecationReason' => !empty($definition['deprecated']) ? !empty($definition['deprecated']) : '',
43
        ]);
44
45
        if ($args = $this->buildArguments($schemaBuilder)) {
46
          $this->definition->addArguments($args);
47
        }
48
      }
49
    }
50
51
    return $this->definition;
52
  }
53
54
  /**
55
   * {@inheritdoc}