Code Duplication    Length = 10-10 lines in 2 locations

src/GraphQL/Type/InterfaceType.php 1 location

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

src/GraphQL/Type/UnionType.php 1 location

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