| Conditions | 1 |
| Paths | 1 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | 9 | protected function linkResponse(Link $link, $merge = []) |
|
| 20 | { |
||
| 21 | 9 | return response()->json( |
|
|
|
|||
| 22 | [ |
||
| 23 | 9 | 'data' => array_merge( |
|
| 24 | [ |
||
| 25 | 9 | 'original_url' => $link->original_url, |
|
| 26 | 9 | 'shortened_url' => $link->shortenedUrl(), |
|
| 27 | 9 | 'code' => $link->code, |
|
| 28 | 9 | 'last_requested' => $link->last_requested, |
|
| 29 | 9 | 'last_used' => $link->last_used ?? null, |
|
| 30 | ], |
||
| 31 | $merge |
||
| 32 | ), |
||
| 33 | ], |
||
| 34 | 9 | 200 |
|
| 35 | ); |
||
| 36 | } |
||
| 37 | } |
||
| 38 |
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: