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

Mutation   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 33
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A __get() 0 4 1
A __set() 0 4 1
A jsonSerialize() 0 4 1
1
<?php
2
3
namespace Softonic\GraphQL;
4
5
use Softonic\GraphQL\Config\MutationConfigObject;
6
use Softonic\GraphQL\Mutation\Item;
7
use Softonic\GraphQL\Query\Item as QueryItem;
8
9
class Mutation
10
{
11
    private $mutation;
12
13
    private $config;
14
15
    /**
16
     * @param array<MutationConfigObject> $mutationConfig
17
     */
18 36
    public function __construct(array $mutationConfig, QueryItem $source)
19
    {
20 36
        $this->config = $mutationConfig['program'];
21
22 36
        $mutationBuilder = new MutationBuilder($this->config, $source);
23
24 36
        $this->mutation = $mutationBuilder->build();
25 36
    }
26
27 28
    public function __get(string $key): Item
28
    {
29 28
        return $this->mutation->{$key};
30
    }
31
32 6
    public function __set(string $key, $value)
33
    {
34 6
        $this->mutation->{$key} = $value;
35 6
    }
36
37 34
    public function jsonSerialize(): array
38
    {
39 34
        return $this->mutation->jsonSerialize();
40
    }
41
}
42