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

SpatieUrlManipulator   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
eloc 8
dl 0
loc 37
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A appendQuery() 0 4 2
A setUrl() 0 3 1
A getUrl() 0 3 1
A removeQuery() 0 3 1
A getQuery() 0 3 1
1
<?php
2
3
namespace Linkeys\UrlSigner\Support\UrlManipulator;
4
5
use Linkeys\UrlSigner\Support\UrlManipulator\UrlManipulator as UrlManipulatorContract;
6
use Spatie\Url\Url;
7
8
class SpatieUrlManipulator implements UrlManipulatorContract
9
{
10
11
    /**
12
     * @var Url
13
     */
14
    protected $url;
15
16 10
    public function setUrl(string $url)
17
    {
18 10
        $this->url = Url::fromString($url);
19 10
    }
20
21
    /**
22
     * @return mixed
23
     */
24 7
    public function getUrl()
25
    {
26 7
        return (string) $this->url;
27
    }
28
29 4
    public function appendQuery(array $newQuery)
30
    {
31 4
        foreach($newQuery as $key => $value) {
32 4
            $this->url = $this->url->withQueryParameter($key, $value);
33
        }
34 4
    }
35
36
37 3
    public function removeQuery($key)
38
    {
39 3
        $this->url = $this->url->withoutQueryParameter($key);
40 3
    }
41
42 3
    public function getQuery() : ?array
43
    {
44 3
        return $this->url->getAllQueryParameters();
45
    }
46
47
}