Completed
Pull Request — 8.x-3.x (#471)
by Sebastian
07:20 queued 03:38
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
   * 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
}