Conditions | 5 |
Paths | 12 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 5.0144 |
Changes | 0 |
1 | <?php |
||
37 | 4 | public static function assertDocumentDivider(int $value, string $message = '') |
|
38 | { |
||
39 | 4 | $haystack = []; |
|
40 | try { |
||
41 | 4 | $reportingCloud = new ReportingCloud(); |
|
42 | 4 | $reflectionClass = new ReflectionClass($reportingCloud); |
|
43 | 4 | foreach ($reflectionClass->getConstants() as $constantKey => $constantValue) { |
|
44 | 4 | if (0 === strpos($constantKey, 'DOCUMENT_DIVIDER_')) { |
|
45 | 4 | $haystack[] = $constantValue; |
|
46 | } |
||
47 | } |
||
48 | 4 | unset($reportingCloud); |
|
49 | } catch (ReflectionException $e) { |
||
50 | // continue |
||
51 | } |
||
52 | |||
53 | 4 | $format = '%s contains an unsupported document divider'; |
|
54 | 4 | $message = sprintf($message ?: $format, self::valueToString($value)); |
|
55 | |||
56 | 4 | return self::oneOf($value, $haystack, $message); |
|
57 | } |
||
59 |