| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 18 | public function successResponse($message, $data = [], int $statusCode = 200) |
||
| 19 | { |
||
| 20 | $responseData = [ |
||
| 21 | 'success' => true, |
||
| 22 | 'message' => $message, |
||
| 23 | ]; |
||
| 24 | |||
| 25 | if ($data) { |
||
|
|
|||
| 26 | $responseData['data'] = $data; |
||
| 27 | } |
||
| 28 | |||
| 29 | return ResponseFactory::successResponse($message, $responseData, $statusCode); |
||
| 30 | } |
||
| 32 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.