JsonLeaf::applies()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Drupal\graphql_json\Plugin\GraphQL\Types;
4
5
6
use Drupal\graphql\GraphQL\Execution\ResolveContext;
7
use Drupal\graphql\Plugin\GraphQL\Types\TypePluginBase;
8
use GraphQL\Type\Definition\ResolveInfo;
9
10
/**
11
 * GraphQL type for json list nodes.
12
 *
13
 * @GraphQLType(
14
 *   id = "json_leaf",
15
 *   name = "JsonLeaf",
16
 *   unions = {"JsonNode"}
17
 * )
18
 */
19
class JsonLeaf extends TypePluginBase {
20
21
  /**
22
   * {@inheritdoc}
23
   */
24
  public function applies($value, ResolveContext $context, ResolveInfo $info) {
25
    return !is_array($value);
26
  }
27
28
}
29