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

Group::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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