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

TypeValidationTrait::isValidValue()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 4
nc 2
nop 1
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
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
}