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

TypeValidationTrait::getPlugin()

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
nc 1
dl 0
loc 1
c 0
b 0
f 0
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
}