Passed
Push — feature/issue-124 ( 91e4aa...dde646 )
by Mikaël
09:46
created

ListRule::getParameterPassedValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WsdlToPhp\PackageGenerator\File\Validation;
6
7
/**
8
 * @see https://www.w3.org/TR/xmlschema-2/#list-datatypes
9
 */
10
final class ListRule extends AbstractSetOfValuesRule
11
{
12 6
    public function name(): string
13
    {
14 6
        return 'list';
15
    }
16
17 6
    public static function getParameterPassedValue(string $parameterName): string
18
    {
19 6
        return sprintf('is_string($%1$s) ? explode(\' \', $%1$s) : $%1$s', $parameterName);
20
    }
21
22 6
    protected function mustApplyRuleOnAttribute(): bool
23
    {
24 6
        return $this->getAttribute()->isList();
25
    }
26
}
27