Completed
Pull Request — master (#48)
by Christoffer
02:02
created

GraphQLException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 84
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 84
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getLocations() 0 3 1
A getExtensions() 0 3 1
A __construct() 0 15 1
A getPath() 0 3 1
1
<?php
2
3
namespace Digia\GraphQL\Error;
4
5
use Digia\GraphQL\Language\AST\Node\NodeInterface;
6
use Digia\GraphQL\Language\Source;
7
8
/**
9
 * An GraphQLException describes an exception thrown during the execute
10
 * phase of performing a GraphQL operation. In addition to a message
11
 * and stack trace, it also includes information about the locations in a
12
 * GraphQL document and/or execution result that correspond to the Error.
13
 */
14
class GraphQLException extends AbstractException
15
{
16
17
    /**
18
     * @var array
19
     */
20
    protected $locations;
21
22
    /**
23
     * @var string[]
24
     */
25
    protected $path;
26
27
    /**
28
     * @var NodeInterface[]
29
     */
30
    protected $nodes;
31
32
    /**
33
     * @var Source|null
34
     */
35
    protected $source;
36
37
    /**
38
     * @var int[]
39
     */
40
    protected $positions;
41
42
    /**
43
     * @var array
44
     */
45
    protected $extensions;
46
47
    /**
48
     * ExecutionException constructor.
49
     *
50
     * @param string      $message
51
     * @param array|null  $nodes
52
     * @param Source|null $source
53
     * @param array|null  $positions
54
     * @param array|null  $path
55
     * @param array|null  $extensions
56
     */
57
    public function __construct(
58
        string $message,
59
        ?array $nodes = null,
60
        ?Source $source = null,
61
        ?array $positions = null,
62
        ?array $path = null,
63
        ?array $extensions = null
64
    ) {
65
        parent::__construct($message);
66
67
        $this->nodes      = $nodes;
68
        $this->source     = $source;
69
        $this->positions  = $positions;
70
        $this->path       = $path;
71
        $this->extensions = $extensions;
72
    }
73
74
    // TODO: Implement the rest of this class.
75
76
    /**
77
     * @return array|null
78
     */
79
    public function getLocations(): ?array
80
    {
81
        return $this->locations;
82
    }
83
84
    /**
85
     * @return array|null
86
     */
87
    public function getPath(): ?array
88
    {
89
        return $this->path;
90
    }
91
92
    /**
93
     * @return array|null
94
     */
95
    public function getExtensions(): ?array
96
    {
97
        return $this->extensions;
98
    }
99
}
100