PluginConfiguration   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 25
ccs 9
cts 9
cp 1
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A explodeStringToArray() 0 13 3
1
<?php
2
3
/*
4
 *  This file is part of the Micro framework package.
5
 *
6
 *  (c) Stanislau Komar <[email protected]>
7
 *
8
 *  For the full copyright and license information, please view the LICENSE
9
 *  file that was distributed with this source code.
10
 */
11
12
namespace Micro\Framework\Kernel\Configuration;
13
14
class PluginConfiguration implements PluginConfigurationInterface
15
{
16 3
    public function __construct(
17
        protected readonly ApplicationConfigurationInterface $configuration
18
    ) {
19 3
    }
20
21
    /**
22
     * @param string|string[] $list
23
     *
24
     * @return string[]
25
     */
26 3
    protected function explodeStringToArray(string|array $list, string $separator = ','): array
27
    {
28 3
        if (\is_array($list)) {
0 ignored issues
show
introduced by
The condition is_array($list) is always true.
Loading history...
29 3
            return $list;
30
        }
31
32 3
        if ('' === $separator) {
33 3
            return [$list];
34
        }
35
36 3
        $itemsColl = explode($separator, $list);
37
38 3
        return array_map('trim', $itemsColl);
39
    }
40
}
41