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.
Passed
Push — master ( 277531...da2303 )
by Toby
06:21 queued 02:58
created

CheckLinkUnchanged   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 9
dl 0
loc 25
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 11 2
1
<?php
2
3
4
namespace Linkeys\UrlSigner\Middleware;
5
6
7
use Closure;
8
use Illuminate\Database\Eloquent\ModelNotFoundException;
9
use Linkeys\UrlSigner\Contracts\Models\Link;
10
use Linkeys\UrlSigner\Exceptions\LinkNotFoundException;
11
use Linkeys\UrlSigner\Support\LinkRepository\LinkRepository;
12
use Linkeys\UrlSigner\Support\UrlManipulator\UrlManipulator;
13
use Symfony\Component\HttpFoundation\Request;
14
15
class CheckLinkUnchanged
16
{
17
18
    /**
19
     * @var UrlManipulator
20
     */
21
    private $urlManipulator;
22
23 2
    public function __construct(UrlManipulator $urlManipulator)
24
    {
25
26 2
        $this->urlManipulator = $urlManipulator;
27 2
    }
28
29 2
    public function handle(Request $request, Closure $next)
30
    {
31
32 2
        $link = $request->get('link');
33
34 2
        $this->urlManipulator->setUrl($request->getUri());
35 2
        $this->urlManipulator->removeQuery(config('links.query_key'));
36 2
        if($link->url !== $this->urlManipulator->getUrl()){
37 1
            throw new LinkNotFoundException;
38
        }
39 1
        return $next($request);
40
    }
41
}