Passed
Pull Request — master (#233)
by Christoffer
03:30
created

StringValueNode::isBlock()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace Digia\GraphQL\Language\Node;
4
5
use Digia\GraphQL\Language\Location;
6
7
class StringValueNode extends AbstractNode implements ValueNodeInterface, ValueAwareInterface
8
{
9
    use ValueTrait;
10
11
    /**
12
     * @var bool
13
     */
14
    protected $block;
15
16
    /**
17
     * StringValueNode constructor.
18
     *
19
     * @param mixed         $value
20
     * @param bool          $block
21
     * @param Location|null $location
22
     */
23
    public function __construct($value, bool $block, ?Location $location)
24
    {
25
        parent::__construct(NodeKindEnum::STRING, $location);
26
27
        $this->value = $value;
28
        $this->block = $block;
29
    }
30
31
    /**
32
     * @return bool
33
     */
34
    public function isBlock(): bool
35
    {
36
        return $this->block;
37
    }
38
39
    /**
40
     * @inheritdoc
41
     */
42
    public function toAST(): array
43
    {
44
        return [
45
            'kind'  => $this->kind,
46
            'loc'   => $this->getLocationAST(),
47
            'block' => $this->block,
48
            'value' => $this->value,
49
        ];
50
    }
51
}
52