Alive2212 /
LaravelSmartResponse
| 1 | <?php |
||||
| 2 | |||||
| 3 | /** |
||||
| 4 | * Created by PhpStorm. |
||||
| 5 | * User: Alive... |
||||
| 6 | * Date: 8/23/17 |
||||
| 7 | * Time: 6:46 AM |
||||
| 8 | */ |
||||
| 9 | |||||
| 10 | namespace Alive2212\LaravelSmartResponse; |
||||
| 11 | |||||
| 12 | use Illuminate\Support\Arr; |
||||
| 13 | |||||
| 14 | class SmartResponse |
||||
| 15 | { |
||||
| 16 | /** |
||||
| 17 | * @param ResponseModel $response |
||||
| 18 | * @return \Illuminate\Http\JsonResponse |
||||
|
0 ignored issues
–
show
|
|||||
| 19 | */ |
||||
| 20 | public static function response(ResponseModel $response) |
||||
| 21 | { |
||||
| 22 | $header = array( |
||||
| 23 | 'Content-Type' => 'application/json; charset=UTF-8', |
||||
| 24 | 'charset' => 'utf-8' |
||||
| 25 | ); |
||||
| 26 | |||||
| 27 | $responseParams = []; |
||||
| 28 | if ($response->getData()->count()) { |
||||
| 29 | $responseParams = Arr::add($responseParams, 'results', $response->getData()); |
||||
| 30 | } |
||||
| 31 | if (!is_null($response->getMessage())) { |
||||
| 32 | $responseParams = Arr::add($responseParams, 'message', $response->getMessage()); |
||||
| 33 | } |
||||
| 34 | if (count($response->getError())) { |
||||
| 35 | $responseParams = Arr::add($responseParams, 'errors', $response->getError()); |
||||
| 36 | } |
||||
| 37 | return response()->json($responseParams, $response->getstatusCode(), $header, JSON_UNESCAPED_UNICODE); |
||||
|
0 ignored issues
–
show
The function
response was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 38 | } |
||||
| 39 | } |
||||
| 40 | |||||
| 41 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths