Code Duplication    Length = 10-10 lines in 2 locations

src/GraphQL/Type/InterfaceType.php 1 location

@@ 46-55 (lines=10) @@
43
  /**
44
   * {@inheritdoc}
45
   */
46
  public function resolveType($object, ResolveInfo $info = NULL) {
47
    /** @var \Drupal\graphql\GraphQL\Type\ObjectType $type */
48
    foreach ($this->types as $type) {
49
      if ($type->applies($object, $info)) {
50
        return $type;
51
      }
52
    }
53
54
    throw new \Exception(sprintf('Could not resolve type for interface %s.', $this->getName()));
55
  }
56
57
  /**
58
   * {@inheritdoc}

src/GraphQL/Type/UnionType.php 1 location

@@ 29-38 (lines=10) @@
26
  /**
27
   * {@inheritdoc}
28
   */
29
  public function resolveType($object, ResolveInfo $info = NULL) {
30
    /** @var \Drupal\graphql\GraphQL\Type\ObjectType $type */
31
    foreach ($this->getTypes() as $type) {
32
      if ($type->applies($object, $info)) {
33
        return $type;
34
      }
35
    }
36
37
    throw new \Exception(sprintf('Could not resolve type for union type %s.', $this->getName()));
38
  }
39
40
  /**
41
   * {@inheritdoc}