Completed
Pull Request — 8.x-3.x (#471)
by Sebastian
02:37
created

TypeValidationTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
getPlugin() 0 1 ?
A isValidValue() 0 7 3
1
<?php
2
3
namespace Drupal\graphql\GraphQL;
4
5
trait TypeValidationTrait {
6
7
  /**
8
   * Retrieves the referenced plugin instance.
9
   *
10
   * @return \Drupal\graphql\Plugin\GraphQL\TypeSystemPluginInterface
11
   *   The referenced plugin instance.
12
   */
13
  abstract public function getPlugin();
14
15
  /**
16
   * {@inheritdoc}
17
   */
18
  public function isValidValue($value) {
19
    if (($plugin = $this->getPlugin()) && $plugin instanceof TypeValidationInterface) {
20
      return $plugin->isValidValue($value);
21
    }
22
23
    return parent::isValidValue($value);
24
  }
25
26
}