Total Complexity | 1 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
10 | trait AssertJsonapiObject |
||
11 | { |
||
12 | /** |
||
13 | * Asserts that a json fragment is a valid jsonapi object. |
||
14 | * |
||
15 | * It will do the following checks : |
||
16 | * 1) asserts that the jsonapi object is not an array of objects (@see assertIsNotArrayOfObjects). |
||
17 | * 2) asserts that the jsonapi object contains only the following allowed members : "version" and "meta" |
||
18 | * (@see assertContainsOnlyAllowedMembers). |
||
19 | * |
||
20 | * Optionaly, if presents, it will checks : |
||
21 | * 3) asserts that the version member is a string. |
||
22 | * 4) asserts that meta member is valid (@see assertIsValidMetaObject). |
||
23 | * |
||
24 | * @param array $json |
||
25 | * @param boolean $strict If true, unsafe characters are not allowed when checking members name. |
||
26 | * |
||
27 | * @return void |
||
28 | * @throws \PHPUnit\Framework\AssertionFailedError |
||
29 | */ |
||
30 | 18 | public static function assertIsValidJsonapiObject($json, bool $strict): void |
|
35 |