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

ScrobbeBuilder   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 57
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A create() 0 4 1
A addTrack() 0 4 1
A count() 0 4 1
A getQuery() 0 16 3
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
final class ScrobbeBuilder
13
{
14
    /**
15
     * @var array
16
     */
17
    private $tracks;
18
19
    private function __construct()
20
    {
21
    }
22
23
    /**
24
     * @return ScrobbeBuilder
25
     */
26
    public function create(): self
27
    {
28
        $this->tracks = [];
29
    }
30
31
    /**
32
     * @param TrackBuilder $builder
33
     *
34
     * @return ScrobbeBuilder
35
     */
36
    public function addTrack(TrackBuilder $builder): self
37
    {
38
        $this->tracks[] = $builder->getData();
39
    }
40
41
    /**
42
     * @return int
43
     */
44
    public function count(): int
45
    {
46
        return \count($this->tracks);
47
    }
48
49
    /**
50
     * @return array
51
     */
52
    public function getQuery(): array
53
    {
54
        $query = [];
55
56
        $tracks = $this->tracks;
57
58
        foreach ($tracks as $i => $track) {
59
            $keys = array_keys($track);
60
61
            foreach ($keys as $key) {
62
                $query[sprintf('%s[%s]', $key, $i)] = $tracks[$i][$key];
63
            }
64
        }
65
66
        return $query;
67
    }
68
}
69