Conditions | 1 |
Paths | 1 |
Total Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
36 | public function __invoke(RequestInterface $request, Response $response, callable $next = null) |
||
37 | { |
||
38 | $data = $request->getParsedBody(); |
||
39 | $data += (new Request())->getFiles()->toArray(); |
||
40 | $imagePath = $this->upload->uploadImage($data, 'file'); |
||
41 | |||
42 | return new JsonResponse(['location' => $imagePath]); |
||
43 | } |
||
44 | } |
||
45 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: