Completed
Pull Request — master (#43)
by Jose Manuel
02:54
created

MutationTypeConfig   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 35
ccs 5
cts 6
cp 0.8333
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __get() 0 8 2
A hasChild() 0 4 1
1
<?php
2
3
namespace Softonic\GraphQL\Config;
4
5
use Softonic\GraphQL\Traits\JsonPathAccessor;
6
7
class MutationTypeConfig
8
{
9
    use JsonPathAccessor;
10
11
    const SCALAR_DATA_TYPE = 'scalar';
12
13
    /**
14
     * @var string
15
     */
16
    public $type;
17
18
    /**
19
     * @var string
20
     */
21
    public $linksTo;
22
23
    /**
24
     * @var array
25
     */
26
    public $children = [];
27
28 4
    public function __get(string $propertyName)
29
    {
30 4
        if (property_exists(static::class, $propertyName)) {
31
            return $this->{$propertyName};
32
        }
33
34 4
        return $this->children[$propertyName] ?? null;
35
    }
36
37 100
    public function hasChild(string $key): bool
38
    {
39 100
        return array_key_exists($key, $this->children);
40
    }
41
}
42