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.
Completed
Push — master ( 490df9...5ffbde )
by Christian
01:33
created

ArtistSearchBuilder::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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
     * @param int $page
38
     *
39
     * @return ArtistSearchBuilder
40
     */
41
    public function page(int $page): self
42
    {
43
        $this->query['p'] = $page;
44
45
        return $this;
46
    }
47
48
    /**
49
     * @param string $mode
50
     *
51
     * @return ArtistSearchBuilder
52
     */
53
    public function sort(string $mode): self
54
    {
55
        if (!\in_array($mode, ['sortName', 'relevance'], true)) {
56
            throw new InvalidArgumentException(sprintf('Invalid sort mode given: %s', $mode));
57
        }
58
59
        $this->query['sort'] = $mode;
60
61
        return $this;
62
    }
63
64
    /**
65
     * @param string $name
66
     *
67
     * @return ArtistSearchBuilder
68
     */
69
    public function withName(string $name): self
70
    {
71
        $this->query['name'] = $name;
72
73
        return $this;
74
    }
75
76
    /**
77
     * @param string $mbid
78
     *
79
     * @return ArtistSearchBuilder
80
     */
81
    public function withMbid(string $mbid): self
82
    {
83
        $this->query['mbid'] = $mbid;
84
85
        return $this;
86
    }
87
88
    /**
89
     * @param int $tmid
90
     *
91
     * @return ArtistSearchBuilder
92
     */
93
    public function withTmbid(int $tmid): self
94
    {
95
        $this->query['tmbid'] = $tmid;
96
97
        return $this;
98
    }
99
100
    /**
101
     * @return array
102
     */
103
    public function getQuery(): array
104
    {
105
        return $this->query;
106
    }
107
}
108