Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| ListRule | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| name | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getParameterPassedValue | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| mustApplyRuleOnAttribute | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 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 | public function name(): string |
| 13 | { |
| 14 | return 'list'; |
| 15 | } |
| 16 | |
| 17 | public static function getParameterPassedValue(string $parameterName): string |
| 18 | { |
| 19 | return sprintf('is_string($%1$s) ? explode(\' \', $%1$s) : $%1$s', $parameterName); |
| 20 | } |
| 21 | |
| 22 | protected function mustApplyRuleOnAttribute(): bool |
| 23 | { |
| 24 | return $this->getAttribute()->isList(); |
| 25 | } |
| 26 | } |