| Conditions | 6 |
| Paths | 8 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | public function resolve(ShortLink $short_link) |
||
| 12 | { |
||
| 13 | // Check if link is expired |
||
| 14 | if ($short_link->expire_at && $short_link->expire_at->isPast()) abort(401); |
||
|
|
|||
| 15 | |||
| 16 | // Check if link is not yet available |
||
| 17 | if ($short_link->not_before && $short_link->not_before->isFuture()) abort(401); |
||
| 18 | |||
| 19 | // Check if link is enabled |
||
| 20 | if (!$short_link->enabled) abort(401); |
||
| 21 | |||
| 22 | // Resolve |
||
| 23 | return response()->redirectTo($short_link->url); |
||
| 24 | } |
||
| 25 | } |
||
| 26 |
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: