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 ( 48ef9d...490df9 )
by Christian
01:26
created

ArtistSearchBuilder   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 86
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 0
dl 0
loc 86
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A page() 0 6 1
A sort() 0 10 2
A withName() 0 6 1
A withMbid() 0 6 1
A withTmbid() 0 6 1
A getQuery() 0 4 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
     * @param int $page
30
     *
31
     * @return ArtistSearchBuilder
32
     */
33
    public function page(int $page): self
34
    {
35
        $this->query['p'] = $page;
36
37
        return $this;
38
    }
39
40
    /**
41
     * @param string $mode
42
     *
43
     * @return ArtistSearchBuilder
44
     */
45
    public function sort(string $mode): self
46
    {
47
        if (!\in_array($mode, ['sortName', 'relevance'], true)) {
48
            throw new InvalidArgumentException(sprintf('Invalid sort mode given: %s', $mode));
49
        }
50
51
        $this->query['sort'] = $mode;
52
53
        return $this;
54
    }
55
56
    /**
57
     * @param string $name
58
     *
59
     * @return ArtistSearchBuilder
60
     */
61
    public function withName(string $name): self
62
    {
63
        $this->query['name'] = $name;
64
65
        return $this;
66
    }
67
68
    /**
69
     * @param string $mbid
70
     *
71
     * @return ArtistSearchBuilder
72
     */
73
    public function withMbid(string $mbid): self
74
    {
75
        $this->query['mbid'] = $mbid;
76
77
        return $this;
78
    }
79
80
    /**
81
     * @param int $tmid
82
     *
83
     * @return ArtistSearchBuilder
84
     */
85
    public function withTmbid(int $tmid): self
86
    {
87
        $this->query['tmbid'] = $tmid;
88
89
        return $this;
90
    }
91
92
    /**
93
     * @return array
94
     */
95
    public function getQuery(): array
96
    {
97
        return $this->query;
98
    }
99
}
100