ListArgumentResolver   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 28
ccs 8
cts 10
cp 0.8
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A findByPath() 0 3 1
A doResolve() 0 8 2
A __construct() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace Diezz\YamlToObjectMapper\Resolver;
4
5
class ListArgumentResolver extends SystemArgumentResolver
6
{
7
    /**
8
     * @var ArgumentResolver[]
9
     */
10
    private array $elements;
11
12
    /**
13
     * @param ArgumentResolver[] $elements
14
     */
15 4
    public function __construct(array $elements)
16
    {
17 4
        $this->elements = $elements;
18 4
    }
19
20 4
    protected function doResolve($context = null): array
21
    {
22 4
        $result = [];
23 4
        foreach ($this->elements as $key => $item) {
24 4
            $result[$key] = $item->resolve($context);
25
        }
26
27 4
        return $result;
28
    }
29
30
    public function findByPath(string $path): ?ArgumentResolver
31
    {
32
        return $this->elements[$path] ?? null;
33
    }
34
}
35