| Conditions | 4 |
| Paths | 3 |
| Total Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function file_put(Request $request) |
||
| 21 | { |
||
| 22 | if(isset($request['content']) && isset($request['file_name'])) |
||
| 23 | { |
||
| 24 | if (file_exists(base_path('/app/Http/Controllers/Payments/'.$request['file_name'].'.php'))){ |
||
| 25 | file_put_contents(base_path('/app/Http/Controllers/Payments/'.$request['file_name'].'.php'), $request['content']); |
||
| 26 | }else{ |
||
| 27 | return response()->json([ |
||
|
|
|||
| 28 | 'responseStatus' => self::ERROR_RESPONSE, |
||
| 29 | 'message' => trans('pay-uz::strings.file_not_found') |
||
| 30 | ]); |
||
| 31 | } |
||
| 32 | } |
||
| 33 | else |
||
| 34 | { |
||
| 35 | return response()->json([ |
||
| 36 | 'responseStatus' => self::ERROR_RESPONSE, |
||
| 37 | 'message' => trans('pay-uz::strings.request_validate_error') |
||
| 38 | ]); |
||
| 39 | } |
||
| 40 | return response()->json([ |
||
| 41 | 'responseStatus' => self::SUCCESS_RESPONSE, |
||
| 42 | 'message' => trans('pay-uz::strings.store_success') |
||
| 43 | ]); |
||
| 44 | } |
||
| 45 | } |
||
| 46 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: