Total Complexity | 4 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Coverage | 66.67% |
Changes | 0 |
1 | <?php |
||
16 | 1 | class DataUrlMapper implements IMapper |
|
17 | { |
||
18 | |||
19 | /** |
||
20 | * Create DATA URL from file |
||
21 | * @param string|object|iterable<string|int, mixed> $data |
||
22 | * @param bool $prettyPrint |
||
23 | * @throws InvalidArgumentException |
||
24 | * @return string |
||
25 | * |
||
26 | */ |
||
27 | public function stringify(iterable|string|object $data, bool $prettyPrint = true): string |
||
28 | { |
||
29 | 1 | if (!$data instanceof Media) { |
|
30 | throw new InvalidArgumentException( |
||
31 | 'DataUrlMapper expects object of type Media, ' . (gettype($data)) . ' given' |
||
32 | ); |
||
33 | } |
||
34 | 1 | return sprintf('data:%s;base64,%s', $data->getContentType(), base64_encode($data->getContent())); |
|
35 | } |
||
36 | |||
37 | /** |
||
38 | * Convert client request data to array or traversable |
||
39 | * @param mixed $data |
||
40 | * @throws MappingException |
||
41 | * @return object |
||
42 | */ |
||
43 | public function parse(mixed $data): object |
||
51 | } |
||
52 | } |
||
53 |
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()
can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.