| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | public function getUrl(Request $request) |
||
| 23 | { |
||
| 24 | $hotelUrl = Config::get('chocolatey.url'); |
||
| 25 | |||
| 26 | $accountType = in_array('NEW_USER', $request->user()->traits) |
||
| 27 | ? 'habbo-client-new-user' : 'habbo-client-user'; |
||
| 28 | |||
| 29 | return response()->json(['clienturl' => "{$hotelUrl}client/{$accountType}"], |
||
|
|
|||
| 30 | 200, [], JSON_UNESCAPED_SLASHES); |
||
| 31 | } |
||
| 32 | |||
| 44 |
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: