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 ( 625674...909c28 )
by Christian
01:42
created

LibraryService::__construct()   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 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Core23\LastFm\Service;
13
14
use Core23\LastFm\Client\ApiClientInterface;
15
use Core23\LastFm\Model\ArtistInfo;
16
use Core23\LastFm\Util\ApiHelper;
17
18
final class LibraryService implements LibraryServiceInterface
19
{
20
    /**
21
     * @var ApiClientInterface
22
     */
23
    private $client;
24
25
    /**
26
     * @param ApiClientInterface $client
27
     */
28
    public function __construct(ApiClientInterface $client)
29
    {
30
        $this->client = $client;
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 View Code Duplication
    public function getArtists(string $user, int $limit = 50, int $page = 1): array
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
37
    {
38
        $response = $this->client->unsignedCall('library.getArtists', [
39
            'user'  => $user,
40
            'limit' => $limit,
41
            'page'  => $page,
42
        ]);
43
44
        if (!isset($response['artists']['artist'])) {
45
            return [];
46
        }
47
48
        return ApiHelper::mapList(
49
            static function ($data) {
50
                return ArtistInfo::fromApi($data);
51
            },
52
            $response['artists']['artist']
53
        );
54
    }
55
}
56