Code Duplication    Length = 26-26 lines in 2 locations

src/GraphQL/Type/EnumType.php 1 location

@@ 13-38 (lines=26) @@
10
use Youshido\GraphQL\Config\Object\EnumTypeConfig;
11
use Youshido\GraphQL\Type\Enum\AbstractEnumType;
12
13
class EnumType extends AbstractEnumType implements TypeSystemPluginReferenceInterface, CacheableEdgeInterface {
14
  use TypeSystemPluginReferenceTrait;
15
  use CacheableEdgeTrait;
16
17
  /**
18
   * {@inheritdoc}
19
   */
20
  public function __construct(EnumPluginBase $plugin, array $config = []) {
21
    $this->plugin = $plugin;
22
    $this->config = new EnumTypeConfig($config, $this);
23
  }
24
25
  /**
26
   * {@inheritdoc}
27
   */
28
  protected function getConfigValue($key, $default = NULL) {
29
    return !empty($this->config) ? $this->config->get($key, $default) : $default;
30
  }
31
32
  /**
33
   * {@inheritdoc}
34
   */
35
  public function getValues() {
36
    return $this->getConfigValue('values', []);
37
  }
38
}
39

src/GraphQL/Type/InputObjectType.php 1 location

@@ 13-38 (lines=26) @@
10
use Youshido\GraphQL\Config\Object\InputObjectTypeConfig;
11
use Youshido\GraphQL\Type\InputObject\AbstractInputObjectType;
12
13
class InputObjectType extends AbstractInputObjectType implements TypeSystemPluginReferenceInterface, CacheableEdgeInterface  {
14
  use TypeSystemPluginReferenceTrait;
15
  use CacheableEdgeTrait;
16
17
  /**
18
   * {@inheritdoc}
19
   */
20
  public function __construct(InputTypePluginBase $plugin, array $config = []) {
21
    $this->plugin = $plugin;
22
    $this->config = new InputObjectTypeConfig($config, $this);
23
  }
24
25
  /**
26
   * {@inheritdoc}
27
   */
28
  protected function getConfigValue($key, $default = NULL) {
29
    return !empty($this->config) ? $this->config->get($key, $default) : $default;
30
  }
31
32
  /**
33
   * {@inheritdoc}
34
   */
35
  public function build($config) {
36
    // Nothing to do here.
37
  }
38
}
39