Completed
Pull Request — 8.x-3.x (#503)
by Sebastian
05:46
created

UploadType::parseValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Drupal\graphql\GraphQL\Type;
4
5
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
6
use Symfony\Component\HttpFoundation\RequestStack;
7
use Youshido\GraphQL\Type\Scalar\AbstractScalarType;
8
9
class UploadType extends AbstractScalarType {
10
  use DependencySerializationTrait;
11
12
  /**
13
   * The request stack.
14
   *
15
   * @var \Symfony\Component\HttpFoundation\RequestStack
16
   */
17
  protected $requestStack;
18
19
  /**
20
   * UploadType constructor.
21
   *
22
   * @param \Symfony\Component\HttpFoundation\RequestStack $requestStack
23
   *   The request stack.
24
   */
25
  public function __construct(RequestStack $requestStack) {
26
    $this->requestStack = $requestStack;
27
  }
28
29
  /**
30
   * {@inheritdoc}
31
   */
32
  public function getName() {
33
    return 'Upload';
34
  }
35
36
  /**
37
   * {@inheritdoc}
38
   */
39
  public function serialize($value) {
40
    throw new \LogicException('Cannot serialize uploaded files.');
41
  }
42
43
  /**
44
   * {@inheritdoc}
45
   */
46
  public function parseValue($value) {
47
    return $value;
48
  }
49
50
  /**
51
   * {@inheritdoc}
52
   */
53
  public function parseInputValue($value) {
54
    return $value;
55
  }
56
57
  /**
58
   * {@inheritdoc}
59
   */
60
  public function isValidValue($value) {
61
    return TRUE;
62
  }
63
64
}
65