Lines
100.00%
3 / 3
Methods
100.00%
3 / 3
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| createAdminApiWireMapper | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| encodeResponse | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| 18 | final readonly class AdminApiCodec | |
| 19 | { | |
| 20 | public function __construct(private WireMapper $adminApiWireMapper) {} | |
| 21 | ||
| 22 | public static function createAdminApiWireMapper(): WireMapper | |
| 23 | { | |
| 24 | return new WireMapper(new ClassShapeReader(ValueConverterCollection::keyedByHandledClass([new IsoInstantConverter()]))); | |
| 25 | } | |
| 26 | ||
| 27 | /** @throws JsonException|StewartException */ | |
| 28 | public function encodeResponse(AdminAppList|AdminAppView|CommandResult|RequestFailed $response): string | |
| 29 | { | |
| 30 | return $this->adminApiWireMapper->encodeObject($response); | |
| 31 | } | |
| 32 | } |