Total Complexity | 5 |
Total Lines | 107 |
Duplicated Lines | 0 % |
Coverage | 40% |
Changes | 0 |
1 | <?php |
||
7 | class ValidatorFactory |
||
8 | { |
||
9 | const VERSION_RESPONSE_VALIDATOR = <<<JSON |
||
10 | { |
||
11 | "title": "VersionResponse", |
||
12 | "type": "object", |
||
13 | "properties": { |
||
14 | "version": { |
||
15 | "type": "string" |
||
16 | } |
||
17 | }, |
||
18 | "required": ["version"] |
||
19 | } |
||
20 | JSON; |
||
21 | |||
22 | const LIST_DEVICES_RESPONSE_VALIDATOR = <<<JSON |
||
23 | { |
||
24 | "title": "ListDevicesResponse", |
||
25 | "type": "array", |
||
26 | "items": { |
||
27 | "type": "object", |
||
28 | "properties": { |
||
29 | "path": { |
||
30 | "type": "string" |
||
31 | }, |
||
32 | "vendor": { |
||
33 | "type": "number" |
||
34 | }, |
||
35 | "product": { |
||
36 | "type": "number" |
||
37 | }, |
||
38 | "session": { |
||
39 | "type": ["string", "null"] |
||
40 | } |
||
41 | }, |
||
42 | "required": [ |
||
43 | "path", "session" |
||
44 | ] |
||
45 | } |
||
46 | } |
||
47 | JSON; |
||
48 | |||
49 | const ACQUIRE_RESPONSE_VALIDATOR = <<<JSON |
||
50 | { |
||
51 | "title": "AcquireResponse", |
||
52 | "type": "object", |
||
53 | "properties": { |
||
54 | "session": { |
||
55 | "type": "string" |
||
56 | } |
||
57 | }, |
||
58 | "required": [ |
||
59 | "session" |
||
60 | ] |
||
61 | } |
||
62 | JSON; |
||
63 | |||
64 | const RELEASE_RESPONSE_VALIDATOR = <<<JSON |
||
65 | { |
||
66 | "title": "ReleaseResponse", |
||
67 | "type": "object", |
||
68 | "properties": {}, |
||
69 | "required": [] |
||
70 | } |
||
71 | JSON; |
||
72 | |||
73 | const CALL_RESPONSE_VALIDATOR = <<<JSON |
||
74 | { |
||
75 | "title": "CallResponse", |
||
76 | "type": "object", |
||
77 | "properties": { |
||
78 | "type": { |
||
79 | "type": "string" |
||
80 | }, |
||
81 | "body": { |
||
82 | "type": "string" |
||
83 | } |
||
84 | }, |
||
85 | "required": [ |
||
86 | "type", "body" |
||
87 | ] |
||
88 | } |
||
89 | JSON; |
||
90 | |||
91 | 3 | public function versionResponse(): \stdClass |
|
92 | { |
||
93 | 3 | return json_decode(self::VERSION_RESPONSE_VALIDATOR); |
|
94 | } |
||
95 | |||
96 | 2 | public function listDevicesResponse(): \stdClass |
|
97 | { |
||
98 | 2 | return json_decode(self::LIST_DEVICES_RESPONSE_VALIDATOR); |
|
99 | } |
||
100 | |||
101 | public function acquireResponse(): \stdClass |
||
102 | { |
||
103 | return json_decode(self::ACQUIRE_RESPONSE_VALIDATOR); |
||
104 | } |
||
105 | |||
106 | public function releaseResponse(): \stdClass |
||
109 | } |
||
110 | |||
111 | public function callResponse(): \stdClass |
||
112 | { |
||
116 |