Passed
Push — master ( abee1f...edc958 )
by Kirill
03:08
created

Group   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 6
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A patch() 0 7 2
A __construct() 0 3 1
1
<?php
2
3
/**
4
 * Spiral Framework.
5
 *
6
 * @license   MIT
7
 * @author    Anton Titov (Wolfy-J)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Spiral\Config\Patch;
13
14
use Spiral\Config\PatchInterface;
15
16
final class Group implements PatchInterface
17
{
18
    /** @var array|PatchInterface[] */
19
    private $patches = [];
20
21
    /**
22
     * @param PatchInterface ...$patch
23
     */
24
    public function __construct(PatchInterface ...$patch)
25
    {
26
        $this->patches = $patch;
27
    }
28
29
    /**
30
     * @param array $config
31
     * @return array
32
     */
33
    public function patch(array $config): array
34
    {
35
        foreach ($this->patches as $patch) {
36
            $config = $patch->patch($config);
37
        }
38
39
        return $config;
40
    }
41
}
42