Passed
Pull Request — master (#5)
by
unknown
01:21
created

DIConfigGenerator::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
1
<?php
2
3
namespace Yiisoft\Yii\Cycle\Config;
4
5
class DIConfigGenerator
6
{
7
    /** @var array */
8
    private $params;
9
10
    public function __construct(&$params)
11
    {
12
        $this->params = $params;
13
    }
14
15
    public function generate(): array
16
    {
17
        $result = [];
18
        foreach ($this->params as $key => &$config) {
19
            if (is_a($key, BaseConfig::class, true)) {
20
                $result[$key] = [
21
                    '__class' => $key,
22
                    'configure()' => [&$config]
23
                ];
24
            }
25
        }
26
        return $result;
27
    }
28
}
29