Conditions | 3 |
Paths | 5 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
29 | public function import() |
||
30 | { |
||
31 | $request = $this->app->request(); |
||
32 | $response = $this->app->response(); |
||
33 | |||
34 | try { |
||
35 | $this->runImport($request); |
||
36 | $result = ['ok' => true, 'size' => $request->getContentLength()]; |
||
37 | } catch (InvalidArgumentException $e) { |
||
38 | $result = ['error' => true, 'message' => $e->getMessage()]; |
||
39 | $response->setStatus(401); |
||
40 | } catch (Exception $e) { |
||
41 | $result = ['error' => true, 'message' => $e->getMessage()]; |
||
42 | $response->setStatus(500); |
||
43 | } |
||
44 | |||
45 | $response['Content-Type'] = 'application/json'; |
||
46 | $response->body(json_encode($result)); |
||
|
|||
47 | } |
||
48 | |||
61 |
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.