Total Complexity | 4 |
Total Lines | 15 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
7 | final class XmlRule extends AbstractRule |
||
8 | { |
||
9 | 4 | public function name(): string |
|
10 | { |
||
11 | 4 | return 'xml'; |
|
12 | } |
||
13 | |||
14 | 4 | public function testConditions(string $parameterName, $value, bool $itemType = false): string |
|
15 | { |
||
16 | 4 | return sprintf(($itemType ? '' : '!is_null($%1$s) && ').'!$%1$s instanceof \DOMDocument && (!is_string($%1$s) || (is_string($%1$s) && (empty($%1$s) || (($%1$sDoc = new \DOMDocument()) && false === $%1$sDoc->loadXML($%1$s)))))', $parameterName); |
|
17 | } |
||
18 | |||
19 | 4 | public function exceptionMessageOnTestFailure(string $parameterName, $value, bool $itemType = false): string |
|
22 | } |
||
23 | } |
||
24 |