Completed
Pull Request — master (#29)
by
unknown
06:10
created

Mutation::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Softonic\GraphQL;
4
5
use Softonic\GraphQL\Config\MutationTypeConfig;
6
use Softonic\GraphQL\Mutation\Item as MutationItem;
7
use Softonic\GraphQL\Query\Item as QueryItem;
8
9
class Mutation implements \JsonSerializable
10
{
11
    /**
12
     * @var MutationItem
13
     */
14
    private $mutation;
15
16
    /**
17
     * @param array<MutationTypeConfig> $config
18
     */
19 34
    public function __construct(array $config, QueryItem $source)
20
    {
21 34
        $mutationBuilder = new MutationBuilder($config, $source);
22
23 34
        $this->mutation = $mutationBuilder->build();
24 34
    }
25
26 32
    public function __get(string $key): MutationItem
27
    {
28 32
        return $this->mutation->{$key};
29
    }
30
31 32
    public function jsonSerialize(): array
32
    {
33 32
        return $this->mutation->jsonSerialize();
34
    }
35
}
36