JsonListItems   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolveValues() 0 5 2
1
<?php
2
3
namespace Drupal\graphql_json\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
 * Retrieve json list items.
11
 *
12
 * @GraphQLField(
13
 *   id = "json_list_items",
14
 *   secure = true,
15
 *   name = "items",
16
 *   type = "JsonNode",
17
 *   multi = true,
18
 *   parents = {"JsonList"}
19
 * )
20
 */
21
class JsonListItems extends FieldPluginBase {
22
23
  /**
24
   * {@inheritdoc}
25
   */
26
  public function resolveValues($value, array $args, ResolveContext $context, ResolveInfo $info) {
27
    foreach ($value as $item) {
28
      yield $item;
29
    }
30
  }
31
32
}
33