1 | <?php |
||
2 | |||
3 | namespace kalanis\Restful\Mapping; |
||
4 | |||
5 | |||
6 | /** |
||
7 | * NullMapper |
||
8 | * @package kalanis\Restful\Mapping |
||
9 | */ |
||
10 | class NullMapper implements IMapper |
||
11 | { |
||
12 | |||
13 | /** |
||
14 | * Convert array or Traversable input to string output response |
||
15 | * @param string|object|iterable<string|int, mixed> $data |
||
16 | * @param bool $prettyPrint |
||
17 | * @return string |
||
18 | */ |
||
19 | public function stringify(iterable|string|object $data, bool $prettyPrint = true): string |
||
20 | { |
||
21 | return ''; |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * Convert client request data to array or traversable |
||
26 | * @param mixed $data |
||
27 | * @return array<string|int, mixed> |
||
28 | */ |
||
29 | public function parse(mixed $data): array |
||
30 | { |
||
31 | return []; |
||
0 ignored issues
–
show
|
|||
32 | } |
||
33 | } |
||
34 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: