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 ( 571668...20e334 )
by Steffen
03:11
created

EcbClientMock   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 4
dl 0
loc 37
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 4
A getExchangeRates() 0 5 1
1
<?php
2
3
namespace SteffenBrand\CurrCurr\Client;
4
5
use Psr\Http\Message\ResponseInterface;
6
use SteffenBrand\CurrCurr\Exception\ExchangeRatesRequestFailedException;
7
use SteffenBrand\CurrCurr\Mapper\ExchangeRatesMapper;
8
use SteffenBrand\CurrCurr\Model\ExchangeRate;
9
use SteffenBrand\CurrCurr\Response\DateMissingResponse;
10
use SteffenBrand\CurrCurr\Response\UsdMissingResponse;
11
use SteffenBrand\CurrCurr\Response\ValidResponse;
12
13
class EcbClientMock implements EcbClientInterface
14
{
15
16
    /**
17
     * @var ResponseInterface
18
     */
19
    private $response;
20
21
    /**
22
     * @param string $expectedResponse
23
     */
24
    public function __construct(string $expectedResponse)
25
    {
26
        switch ($expectedResponse) {
27
            case 'ValidResponse':
28
                $this->response = new ValidResponse();
29
                break;
30
            case 'UsdMissingResponse':
31
                $this->response = new UsdMissingResponse();
32
                break;
33
            case 'DateMissingResponse':
34
                $this->response = new DateMissingResponse();
35
                break;
36
        }
37
    }
38
39
    /**
40
     * @throws ExchangeRatesRequestFailedException
41
     * @return ExchangeRate[]
42
     */
43
    public function getExchangeRates(): array
44
    {
45
        $mapper = new ExchangeRatesMapper();
46
        return $mapper->map($this->response);
47
    }
48
49
}