Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
75.00% |
3 / 4 |
|
75.00% |
3 / 4 |
CRAP | |
0.00% |
0 / 1 |
JsonDecoder | |
75.00% |
3 / 4 |
|
75.00% |
3 / 4 |
4.25 | |
0.00% |
0 / 1 |
withParsedBody | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
withOptions | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
decode | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
requiresCsrf | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | namespace Apie\Serializer\Encoders; |
3 | |
4 | use Apie\Serializer\Interfaces\DecoderInterface; |
5 | |
6 | class JsonDecoder implements DecoderInterface |
7 | { |
8 | public function withParsedBody(null|array|object $parsedBody): DecoderInterface |
9 | { |
10 | return $this; |
11 | } |
12 | |
13 | public function withOptions(string $options): DecoderInterface |
14 | { |
15 | return $this; |
16 | } |
17 | |
18 | public function decode(string $input): string|int|float|bool|array|null |
19 | { |
20 | return json_decode($input, true); |
21 | } |
22 | |
23 | public function requiresCsrf(): bool |
24 | { |
25 | return false; |
26 | } |
27 | } |