| Total Complexity | 4 | 
| Total Lines | 84 | 
| Duplicated Lines | 0 % | 
| Coverage | 100% | 
| Changes | 0 | ||
| 1 | <?php | ||
| 7 | class ValidatorFactory | ||
| 8 | { | ||
| 9 | const VERSION_RESPONSE_VALIDATOR = <<<EOJSON | ||
| 10 | { | ||
| 11 | "title": "VersionResponse", | ||
| 12 | "type": "object", | ||
| 13 |     "properties": { | ||
| 14 |         "version": { | ||
| 15 | "type": "string" | ||
| 16 | } | ||
| 17 | }, | ||
| 18 | "required": ["version"] | ||
| 19 | } | ||
| 20 | EOJSON; | ||
| 21 | |||
| 22 | const LIST_DEVICES_RESPONSE_VALIDATOR = <<<EOJSON | ||
| 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 | EOJSON; | ||
| 48 | |||
| 49 | const ACQUIRE_RESPONSE_VALIDATOR = <<<EOJSON | ||
| 50 | { | ||
| 51 | "title": "AcquireResponse", | ||
| 52 | "type": "object", | ||
| 53 |   "properties": { | ||
| 54 |     "session": { | ||
| 55 | "type": "string" | ||
| 56 | } | ||
| 57 | }, | ||
| 58 | "required": [ | ||
| 59 | "session" | ||
| 60 | ] | ||
| 61 | } | ||
| 62 | EOJSON; | ||
| 63 | |||
| 64 | const RELEASE_RESPONSE_VALIDATOR = <<<EOJSON | ||
| 65 | { | ||
| 66 | "title": "ReleaseResponse", | ||
| 67 | "type": "object", | ||
| 68 |   "properties": {}, | ||
| 69 | "required": [] | ||
| 70 | } | ||
| 71 | EOJSON; | ||
| 72 | |||
| 73 | 5 | public function versionResponse(): \stdClass | |
| 74 |     { | ||
| 75 | 5 | return json_decode(self::VERSION_RESPONSE_VALIDATOR); | |
| 76 | } | ||
| 77 | |||
| 78 | 3 | public function listDevicesResponse(): \stdClass | |
| 79 |     { | ||
| 80 | 3 | return json_decode(self::LIST_DEVICES_RESPONSE_VALIDATOR); | |
| 81 | } | ||
| 82 | |||
| 83 | 3 | public function acquireResponse(): \stdClass | |
| 84 |     { | ||
| 85 | 3 | return json_decode(self::ACQUIRE_RESPONSE_VALIDATOR); | |
| 86 | } | ||
| 87 | |||
| 88 | 3 | public function releaseResponse(): \stdClass | |
| 91 | } | ||
| 92 | } | ||
| 93 |