Passed
Push — master ( 72f8f4...a05bce )
by Jesús
07:47 queued 11s
created

ConfigGacelaMapper::isSingleConfigFile()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gacela\Framework\Config;
6
7
use Gacela\Framework\Config\GacelaFileConfig\GacelaConfigItem;
8
9
final class ConfigGacelaMapper
10
{
11
    /**
12
     * @param list<array{path?:string, path_local?:string, reader?:ConfigReaderInterface}>|array{path?:string, path_local?:string, reader?:ConfigReaderInterface} $config
13
     *
14
     * @return list<GacelaConfigItem>
15
     */
16 24
    public function mapConfigItems(array $config): array
17
    {
18 24
        if (isset($config['path']) || isset($config['path_local'])) {
19
            /** @psalm-suppress InvalidArgument */
20 2
            return [GacelaConfigItem::fromArray($config)]; // @phpstan-ignore-line
0 ignored issues
show
Bug Best Practice introduced by
The expression return array(Gacela\Fram...em::fromArray($config)) returns the type array<integer,Gacela\Fra...onfig\GacelaConfigItem> which is incompatible with the documented return type Gacela\Framework\Config\list.
Loading history...
21
        }
22
23 22
        $result = [];
24
25
        /** @var list<array{path?:string, path_local?:string, reader?:ConfigReaderInterface}> $config */
26 22
        foreach ($config as $configItem) {
27 1
            $c = GacelaConfigItem::fromArray($configItem);
28 1
            $result[] = $c;
29
        }
30
31 22
        return $result;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $result returns the type Gacela\Framework\Config\...acelaConfigItem[]|array which is incompatible with the documented return type Gacela\Framework\Config\list.
Loading history...
32
    }
33
}
34