| Conditions | 4 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 16 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 3 | public function __construct($tagName, $elements, array $definedVariables, $depth, $xml) |
|
| 18 | { |
||
| 19 | 3 | $expectedElements = []; |
|
| 20 | 3 | foreach ($definedVariables as $variableName => $variable) { |
|
| 21 | 3 | if (substr($variableName, 0, 4) !== 'flag') { |
|
| 22 | 3 | continue; |
|
| 23 | } |
||
| 24 | |||
| 25 | 3 | if (($elements & $variable) === $variable) { |
|
| 26 | 3 | $expectedElements[] = substr($variableName, 4); |
|
| 27 | 3 | } |
|
| 28 | 3 | } |
|
| 29 | |||
| 30 | 3 | $this->message = sprintf( |
|
| 31 | 3 | 'Invalid XML. Expected one of "%s", got "%s" on depth %d (context: "%s")', |
|
| 32 | 3 | implode('", "', $expectedElements), |
|
| 33 | 3 | $tagName, |
|
| 34 | 3 | $depth, |
|
| 35 | $xml |
||
| 36 | 3 | ); |
|
| 37 | 3 | } |
|
| 38 | } |
||
| 39 |