Code Duplication    Length = 10-10 lines in 2 locations

src/GraphQL/Type/InterfaceType.php 1 location

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

src/GraphQL/Type/UnionType.php 1 location

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