Completed
Pull Request — 8.x-3.x (#525)
by Philipp
02:28
created

Upload   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 3
lcom 0
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A serialize() 0 3 1
A parseValue() 0 3 1
A parseLiteral() 0 3 1
1
<?php
2
3
namespace Drupal\graphql\Plugin\GraphQL\Scalars\Upload;
4
5
use Drupal\graphql\Plugin\GraphQL\Scalars\ScalarPluginBase;
6
7
/**
8
 * @GraphQLScalar(
9
 *   id = "upload",
10
 *   name = "Upload"
11
 * )
12
 */
13
class Upload extends ScalarPluginBase {
14
15
  /**
16
   * {@inheritdoc}
17
   */
18
  public static function serialize($value) {
19
    throw new \LogicException('Cannot serialize uploaded files.');
20
  }
21
22
  /**
23
   * {@inheritdoc}
24
   */
25
  public static function parseValue($value) {
26
    return $value;
27
  }
28
29
  /**
30
   * {@inheritdoc}
31
   */
32
  public static function parseLiteral($ast) {
33
    throw new \LogicException('Uploaded files have to be referenced in variables.');
34
  }
35
36
}
37