Completed
Pull Request — master (#29)
by
unknown
01:39
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\MutationObject;
7
use Softonic\GraphQL\Query\ReadObject;
8
9
class Mutation implements \JsonSerializable
10
{
11
    /**
12
     * @var MutationObject
13
     */
14
    private $mutation;
15
16
    /**
17
     * @param array<MutationTypeConfig> $config
18
     */
19 48
    public function __construct(array $config, ReadObject $source)
20
    {
21 48
        $mutationBuilder = new MutationBuilder($config, $source);
22
23 48
        $this->mutation = $mutationBuilder->build();
24 48
    }
25
26 46
    public function __get(string $key): MutationObject
27
    {
28 46
        return $this->mutation->{$key};
29
    }
30
31 44
    public function jsonSerialize(): array
32
    {
33 44
        return $this->mutation->jsonSerialize();
34
    }
35
}
36