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

MutationConfig   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 22
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 3
A get() 0 4 1
1
<?php
2
3
namespace Softonic\GraphQL\Config;
4
5
class MutationConfig
6
{
7
    private $configObjects;
8
9 50
    public function __construct(array $config)
10
    {
11 50
        foreach ($config as $mutationName => $mutationConfig) {
12 50
            $this->configObjects[$mutationName] = [];
13 50
            foreach ($mutationConfig as $param => $cfg) {
14 50
                $this->configObjects[$mutationName][$param] = new MutationConfigObject($cfg);
15
            }
16
        }
17 50
    }
18
19
    /**
20
     * @return array<MutationConfigObject>
21
     */
22 50
    public function get(string $mutationName): array
23
    {
24 50
        return $this->configObjects[$mutationName];
25
    }
26
}
27