Completed
Push — 8.x-3.x ( e67c0e...2e01b0 )
by Philipp
02:27
created

BatchedField::getBatchId()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
cc 3
eloc 4
nc 2
nop 3
dl 7
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Drupal\graphql\GraphQL\Field;
4
5
use Drupal\graphql\GraphQL\Batching\BatchedFieldInterface;
6
use Youshido\GraphQL\Execution\ResolveInfo;
7
8
class BatchedField extends Field implements BatchedFieldInterface {
9
10
  /**
11
   * {@inheritdoc}
12
   */
13 View Code Duplication
  public function getBatchedFieldResolver($parent, array $arguments, ResolveInfo $info) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
    if (($plugin = $this->getPluginFromResolveInfo($info)) && $plugin instanceof BatchedFieldInterface) {
15
      return $plugin->getBatchedFieldResolver($parent, $arguments, $info);
16
    }
17
18
    return NULL;
19
  }
20
21
  /**
22
   * {@inheritdoc}
23
   */
24 View Code Duplication
  public function getBatchId($parent, array $arguments, ResolveInfo $info) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
25
    if (($plugin = $this->getPluginFromResolveInfo($info)) && $plugin instanceof BatchedFieldInterface) {
26
      return $plugin->getBatchId($parent, $arguments, $info);
27
    }
28
29
    return NULL;
30
  }
31
32
  /**
33
   * {@inheritdoc}
34
   */
35
  public function resolveBatch(array $batch) {
36
    if (($plugin = $this->getPluginFromResolveInfo($batch['info'])) && $plugin instanceof BatchedFieldInterface) {
37
      return $plugin->resolveBatch($batch);
38
    }
39
40
    return NULL;
41
  }
42
}
43