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.

TrackBuilder::withTrackNumber()   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\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
     * @return TrackBuilder
28
     */
29
    public static function create(string $artist, string $track, DateTime $date): self
30
    {
31
        return new static([
32
            'artist'    => $artist,
33
            'track'     => $track,
34
            'timestamp' => $date->getTimestamp(),
35
        ]);
36
    }
37
38
    /**
39
     * @return TrackBuilder
40
     */
41
    public function withAlbum(string $album): self
42
    {
43
        $this->data['album'] = $album;
44
45
        return $this;
46
    }
47
48
    /**
49
     * @return TrackBuilder
50
     */
51
    public function withContext(string $context): self
52
    {
53
        $this->data['context'] = $context;
54
55
        return $this;
56
    }
57
58
    /**
59
     * @return TrackBuilder
60
     */
61
    public function withStreamId(int $streamId): self
62
    {
63
        $this->data['streamId'] = $streamId;
64
65
        return $this;
66
    }
67
68
    /**
69
     * @return TrackBuilder
70
     */
71
    public function withChosenByUser(bool $choosenByUser): self
72
    {
73
        $this->data['chosenByUser'] = $choosenByUser ? 1 : 0;
74
75
        return $this;
76
    }
77
78
    /**
79
     * @return TrackBuilder
80
     */
81
    public function withTrackNumber(int $trackNumber): self
82
    {
83
        $this->data['trackNumber'] = $trackNumber;
84
85
        return $this;
86
    }
87
88
    /**
89
     * @return TrackBuilder
90
     */
91
    public function withMbid(string $mbid): self
92
    {
93
        $this->data['mbid'] = $mbid;
94
95
        return $this;
96
    }
97
98
    /**
99
     * @return TrackBuilder
100
     */
101
    public function withAlbumArtist(string $albumArtist): self
102
    {
103
        $this->data['albumArtist'] = $albumArtist;
104
105
        return $this;
106
    }
107
108
    /**
109
     * @return TrackBuilder
110
     */
111
    public function withDuration(int $seconds): self
112
    {
113
        $this->data['duration'] = $seconds;
114
115
        return $this;
116
    }
117
118
    public function getData(): array
119
    {
120
        return $this->data;
121
    }
122
}
123