| Conditions | 4 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | public function login($request, $response, $args) |
||
| 11 | { |
||
| 12 | $params = $request->getParams(); |
||
| 13 | if(!isset($params['username']) || !isset($params['password'])) |
||
| 14 | { |
||
| 15 | return $response->withStatus(400); |
||
| 16 | } |
||
| 17 | $auth = AuthProvider::getInstance(); |
||
| 18 | $res = $auth->login($params['username'], $params['password']); |
||
| 19 | if($res === false) |
||
| 20 | { |
||
| 21 | return $response->withStatus(403); |
||
| 22 | } |
||
| 23 | else |
||
| 24 | { |
||
| 25 | return $response->withJson($res); |
||
| 26 | } |
||
| 27 | } |
||
| 28 | |||
| 36 |
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.