ViewRowField   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolveValues() 0 6 2
1
<?php
2
3
namespace Drupal\graphql_views\Plugin\GraphQL\Fields;
4
5
use Drupal\graphql\GraphQL\Execution\ResolveContext;
6
use Drupal\graphql\Plugin\GraphQL\Fields\FieldPluginBase;
7
use GraphQL\Type\Definition\ResolveInfo;
8
9
/**
10
 * Expose view row fields for configured fieldable views.
11
 *
12
 * @GraphQLField(
13
 *   id = "view_row_field",
14
 *   secure = true,
15
 *   provider = "views",
16
 *   deriver = "Drupal\graphql_views\Plugin\Deriver\Fields\ViewRowFieldDeriver"
17
 * )
18
 */
19
class ViewRowField extends FieldPluginBase {
20
21
  /**
22
   * {@inheritdoc}
23
   */
24
  public function resolveValues($value, array $args, ResolveContext $context, ResolveInfo $info) {
25
    $definition = $this->getPluginDefinition();
26
    if (isset($value[$definition['field']])) {
27
      yield $value[$definition['field']];
28
    }
29
  }
30
31
}
32