GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (13)

src/Middleware/CheckLinkValid.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Linkeys\UrlSigner\Middleware;
4
5
use Closure;
6
use Illuminate\Database\Eloquent\ModelNotFoundException;
7
use Illuminate\Support\Facades\Event;
8
use Linkeys\UrlSigner\Contracts\Models\Link;
9
use Linkeys\UrlSigner\Events\LinkClicked;
10
use Linkeys\UrlSigner\Exceptions\ClickLimit\LinkClickLimitReachedException;
11
use Linkeys\UrlSigner\Exceptions\ClickLimit\LinkGroupClickLimitReachedException;
12
use Linkeys\UrlSigner\Exceptions\Expiry\LinkExpiredException;
13
use Linkeys\UrlSigner\Exceptions\Expiry\LinkGroupExpiredException;
14
use Linkeys\UrlSigner\Exceptions\LinkNotFoundException;
15
use Linkeys\UrlSigner\Support\LinkRepository\LinkRepository;
16
use Symfony\Component\HttpFoundation\Request;
17
18
class CheckLinkValid
19
{
20
21 11
        public function handle(Request $request, Closure $next)
22
    {
23
24 11
        $link = $request->get(\Linkeys\UrlSigner\Models\Link::class);
25
26 11
        if($link->clickLimitReached()) {
27 1
            throw new LinkClickLimitReachedException;
28
        }
29 10
        if($link->group && $link->group->clickLimitReached()) {
30 1
            throw new LinkGroupClickLimitReachedException;
31
        }
32 9
        if($link->expired()) {
33 3
            throw new LinkExpiredException;
34
        }
35
36 6
        if($link->group && $link->group->expired() && $link->expiry === null) {
37 1
            throw new LinkGroupExpiredException;
38
        }
39
40 5
        Event::dispatch(new LinkClicked($link));
0 ignored issues
show
It seems like $link can also be of type null; however, parameter $link of Linkeys\UrlSigner\Events...kClicked::__construct() does only seem to accept Linkeys\UrlSigner\Contracts\Models\Link, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

40
        Event::dispatch(new LinkClicked(/** @scrutinizer ignore-type */ $link));
Loading history...
41
42 5
        return $next($request);
43
    }
44
45
}