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 ( 981090...e30cbf )
by Christian
01:43
created

TrackBuilder::withStreamId()   A

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\LastFm\Builder;
11
12
use DateTime;
13
14
final class TrackBuilder
15
{
16
    /**
17
     * @var array
18
     */
19
    private $data;
20
21
    private function __construct(array $data)
22
    {
23
        $this->data = $data;
24
    }
25
26
    /**
27
     * @param string   $artist
28
     * @param string   $track
29
     * @param DateTime $date
30
     *
31
     * @return TrackBuilder
32
     */
33
    public static function create(string $artist, string $track, DateTime $date): self
34
    {
35
        return new static([
36
            'artist'    => $artist,
37
            'track'     => $track,
38
            'timestamp' => $date->getTimestamp(),
39
        ]);
40
    }
41
42
    /**
43
     * @param string $album
44
     *
45
     * @return TrackBuilder
46
     */
47
    public function withAlbum(string $album): self
48
    {
49
        $this->data['album'] = $album;
50
51
        return $this;
52
    }
53
54
    /**
55
     * @param string $context
56
     *
57
     * @return TrackBuilder
58
     */
59
    public function withContext(string $context): self
60
    {
61
        $this->data['context'] = $context;
62
63
        return $this;
64
    }
65
66
    /**
67
     * @param string $streamId
68
     *
69
     * @return TrackBuilder
70
     */
71
    public function withStreamId(string $streamId): self
72
    {
73
        $this->data['streamId'] = $streamId;
74
75
        return $this;
76
    }
77
78
    /**
79
     * @param string $chosenByUser
80
     *
81
     * @return TrackBuilder
82
     */
83
    public function withChosenByUser(string $chosenByUser): self
84
    {
85
        $this->data['chosenByUser'] = $chosenByUser;
86
87
        return $this;
88
    }
89
90
    /**
91
     * @param string $trackNumber
92
     *
93
     * @return TrackBuilder
94
     */
95
    public function withTrackNumber(string $trackNumber): self
96
    {
97
        $this->data['trackNumber'] = $trackNumber;
98
99
        return $this;
100
    }
101
102
    /**
103
     * @param string $mbid
104
     *
105
     * @return TrackBuilder
106
     */
107
    public function withMbid(string $mbid): self
108
    {
109
        $this->data['mbid'] = $mbid;
110
111
        return $this;
112
    }
113
114
    /**
115
     * @param string $albumArtist
116
     *
117
     * @return TrackBuilder
118
     */
119
    public function withAlbumArtist(string $albumArtist): self
120
    {
121
        $this->data['albumArtist'] = $albumArtist;
122
123
        return $this;
124
    }
125
126
    /**
127
     * @param string $duration
128
     *
129
     * @return TrackBuilder
130
     */
131
    public function withDuration(string $duration): self
132
    {
133
        $this->data['duration'] = $duration;
134
135
        return $this;
136
    }
137
138
    /**
139
     * @return array
140
     */
141
    public function getData(): array
142
    {
143
        return $this->data;
144
    }
145
}
146