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.

ArtistSearchBuilder::withMbid()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * (c) Christian Gripp <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Core23\SetlistFm\Builder;
11
12
use InvalidArgumentException;
13
14
final class ArtistSearchBuilder
15
{
16
    /**
17
     * @var array
18
     */
19
    private $query;
20
21
    private function __construct()
22
    {
23
        $this->query = [];
24
25
        $this->page(1);
26
    }
27
28
    /**
29
     * @return ArtistSearchBuilder
30
     */
31
    public static function create(): self
32
    {
33
        return new static();
34
    }
35
36
    /**
37
     * @return ArtistSearchBuilder
38
     */
39
    public function page(int $page): self
40
    {
41
        $this->query['p'] = $page;
42
43
        return $this;
44
    }
45
46
    /**
47
     * @return ArtistSearchBuilder
48
     */
49
    public function sort(string $mode): self
50
    {
51
        if (!\in_array($mode, ['sortName', 'relevance'], true)) {
52
            throw new InvalidArgumentException(sprintf('Invalid sort mode given: %s', $mode));
53
        }
54
55
        $this->query['sort'] = $mode;
56
57
        return $this;
58
    }
59
60
    /**
61
     * @return ArtistSearchBuilder
62
     */
63
    public function withName(string $name): self
64
    {
65
        $this->query['artistName'] = $name;
66
67
        return $this;
68
    }
69
70
    /**
71
     * @return ArtistSearchBuilder
72
     */
73
    public function withMbid(string $mbid): self
74
    {
75
        $this->query['artistMbid'] = $mbid;
76
77
        return $this;
78
    }
79
80
    /**
81
     * @return ArtistSearchBuilder
82
     */
83
    public function withTmbid(int $tmid): self
84
    {
85
        $this->query['artistTmid'] = $tmid;
86
87
        return $this;
88
    }
89
90
    public function getQuery(): array
91
    {
92
        return $this->query;
93
    }
94
}
95