These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | use Slim\Slim; |
||
4 | |||
5 | class Xhgui_Controller_Import extends Xhgui_Controller |
||
0 ignored issues
–
show
|
|||
6 | { |
||
7 | /** |
||
8 | * @var Xhgui_Saver_Mongo |
||
9 | */ |
||
10 | private $saver; |
||
11 | |||
12 | public function __construct(Slim $app, Xhgui_Saver_Mongo $saver) |
||
13 | { |
||
14 | $this->app = $app; |
||
15 | $this->saver = $saver; |
||
16 | } |
||
17 | |||
18 | public function import() |
||
19 | { |
||
20 | $request = $this->app->request(); |
||
21 | $response = $this->app->response(); |
||
22 | |||
23 | $data = json_decode($request->getBody(), true); |
||
24 | $this->saver->save($data); |
||
25 | |||
26 | $response['Content-Type'] = 'application/json'; |
||
27 | $response->body(json_encode(['ok' => true])); |
||
0 ignored issues
–
show
|
|||
28 | } |
||
29 | } |
||
30 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.