Passed
Branch init (43954b)
by Pulkit
05:57
created

LastFm   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getConfig() 0 4 1
A setConfig() 0 4 1
A setApiKey() 0 4 1
A getApiKey() 0 4 1
A getVersion() 0 4 1
A getProviderName() 0 4 1
A getResource() 0 4 1
1
<?php
2
namespace Sourceout\LastFm\Providers\LastFm;
3
4
use Sourceout\LastFm\Http\Http;
5
use Sourceout\LastFm\Providers\GeoInterface;
6
use Sourceout\LastFm\Providers\ProviderInterface;
7
use Sourceout\LastFm\Providers\ResourceInterface;
8
use Sourceout\LastFm\Providers\LastFm\Resources\Geo;
9
use Sourceout\LastFm\Providers\LastFm\Resources\Resource;
10
11
class LastFm implements ProviderInterface
12
{
13
    /** @var array */
14
    protected $config;
15
16
    /** @inheritDoc */
17
    public function __construct(array $config)
18
    {
19
        $this->config = $config;
20
    }
21
22
    /** @inheritDoc */
23
    public function getConfig() : array
24
    {
25
        return $this->config;
26
    }
27
28
    /** @inheritDoc */
29
    public function setConfig(array $config) : void
30
    {
31
        $this->config = $config;
32
    }
33
34
    /**
35
     * Setter for API Key (Provider Specific Method)
36
     *
37
     * @param string $apiKey
38
     * @return void
39
     */
40
    public function setApiKey(string $apiKey) : void
41
    {
42
        $this->config['api_key'] = $apiKey;
43
    }
44
45
    /**
46
     * Getter for API Key (Provider Specific Method)
47
     *
48
     * @return string
49
     */
50
    public function getApiKey() : string
51
    {
52
        return $this->config['api_key'];
53
    }
54
55
    /** @inheritDoc */
56
    public function getVersion() : string
57
    {
58
        return '2.0';
59
    }
60
61
    /** @inheritDoc */
62
    public function getProviderName() : string
63
    {
64
        return 'LastFm';
65
    }
66
67
    /** @inheritDoc */
68
    public function getResource() : ResourceInterface
69
    {
70
        return new Resource($this, new Http());
71
    }
72
}