| Total Complexity | 3 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | trait AssertArrays |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Asserts that an array is an array of objects. |
||
| 14 | * |
||
| 15 | * @param array $json |
||
| 16 | * @param string $message An optional message to explain why the test failed |
||
| 17 | * |
||
| 18 | * @return void |
||
| 19 | * @throws \PHPUnit\Framework\AssertionFailedError |
||
| 20 | */ |
||
| 21 | 48 | public static function assertIsArrayOfObjects($json, $message = ''): void |
|
| 24 | 33 | } |
|
| 25 | |||
| 26 | /** |
||
| 27 | * Asserts that an array is not an array of objects. |
||
| 28 | * |
||
| 29 | * @param array $json |
||
| 30 | * @param string $message An optional message to explain why the test failed |
||
| 31 | * |
||
| 32 | * @return void |
||
| 33 | * @throws \PHPUnit\Framework\AssertionFailedError |
||
| 34 | */ |
||
| 35 | 18 | public static function assertIsNotArrayOfObjects($json, $message = ''): void |
|
| 38 | 9 | } |
|
| 39 | |||
| 40 | /** |
||
| 41 | * Checks if the given array is an array of objects. |
||
| 42 | * |
||
| 43 | * @param array $arr |
||
| 44 | * |
||
| 45 | * @return boolean |
||
| 46 | */ |
||
| 47 | 39 | protected static function isArrayOfObjects(array $arr): bool |
|
| 52 |