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

TypeValidationTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 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
   * @return \Drupal\graphql\Plugin\GraphQL\TypeSystemPluginInterface
9
   */
10
  abstract public function getPlugin();
11
12
  /**
13
   * {@inheritdoc}
14
   */
15
  public function isValidValue($value) {
16
    if (($plugin = $this->getPlugin()) && $plugin instanceof TypeValidationInterface) {
17
      return $plugin->isValidValue($value);
18
    }
19
20
    return parent::isValidValue($value);
21
  }
22
23
}