1
|
|
|
<?php |
2
|
|
|
declare (strict_types = 1); |
3
|
|
|
|
4
|
|
|
namespace VGirol\JsonApiAssert; |
5
|
|
|
|
6
|
|
|
use VGirol\JsonApiAssert\Asserts\AssertArrays; |
7
|
|
|
use VGirol\JsonApiAssert\Asserts\AssertAttributesObject; |
8
|
|
|
use VGirol\JsonApiAssert\Asserts\AssertErrorsObject; |
9
|
|
|
use VGirol\JsonApiAssert\Asserts\AssertJsonapiObject; |
10
|
|
|
use VGirol\JsonApiAssert\Asserts\AssertLinksObject; |
11
|
|
|
use VGirol\JsonApiAssert\Asserts\AssertMemberName; |
12
|
|
|
use VGirol\JsonApiAssert\Asserts\AssertMembers; |
13
|
|
|
use VGirol\JsonApiAssert\Asserts\AssertMetaObject; |
14
|
|
|
use VGirol\JsonApiAssert\Asserts\AssertRelationshipsObject; |
15
|
|
|
use VGirol\JsonApiAssert\Asserts\AssertResourceLinkage; |
16
|
|
|
use VGirol\JsonApiAssert\Asserts\AssertResourceObject; |
17
|
|
|
use VGirol\JsonApiAssert\Asserts\AssertStructure; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* This class provide a set of assertions to test documents using the JSON:API specification. |
21
|
|
|
*/ |
22
|
|
|
class Assert |
23
|
|
|
{ |
24
|
|
|
use AssertArrays; |
25
|
|
|
use AssertAttributesObject; |
26
|
|
|
use AssertErrorsObject; |
27
|
|
|
use AssertJsonapiObject; |
28
|
|
|
use AssertLinksObject; |
29
|
|
|
use AssertMemberName; |
30
|
|
|
use AssertMembers; |
31
|
|
|
use AssertMetaObject; |
32
|
|
|
use AssertRelationshipsObject; |
33
|
|
|
use AssertResourceLinkage; |
34
|
|
|
use AssertResourceObject; |
35
|
|
|
use AssertStructure; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Throws an Exception because of an invalid argument passed to a method. |
39
|
|
|
* |
40
|
|
|
* @param integer $argument |
41
|
|
|
* @param string $type |
42
|
|
|
* @param mixed $value |
43
|
|
|
* @return void |
44
|
|
|
* @throws \VGirol\JsonApiAssert\Exception |
45
|
|
|
* |
46
|
|
|
* @SuppressWarnings(PHPMD.StaticAccess) |
47
|
|
|
*/ |
48
|
|
|
protected static function invalidArgument(int $argument, string $type, $value = null): void |
49
|
|
|
{ |
50
|
|
|
throw InvalidArgumentHelper::factory($argument, $type, $value); |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|