PluginConfiguration::explodeStringToArray()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 6
c 1
b 0
f 0
nc 3
nop 2
dl 0
loc 13
ccs 7
cts 7
cp 1
crap 3
rs 10
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