Service::getBaseCode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @category    Brownie/ExchangeRate
4
 * @author      Brownie <[email protected]>
5
 * @license     https://opensource.org/licenses/MIT
6
 */
7
8
namespace Brownie\ExchangeRate;
9
10
use Brownie\HttpClient\HttpClient;
11
12
/**
13
 * Base class for services.
14
 */
15
class Service
16
{
17
18
    /**
19
     * Base currency.
20
     *
21
     * @var string
22
     */
23
    protected $baseCode = 'USD';
24
25
    /**
26
     * HTTP client.
27
     *
28
     * @var HttpClient
29
     */
30
    private $httpClient;
31
32
    /**
33
     * Sets the input values.
34
     *
35
     * @param HttpClient    $httpClient     HTTP client.
36
     */
37 21
    public function __construct(HttpClient $httpClient)
38
    {
39 21
        $this->setHttpClient($httpClient);
40 21
    }
41
42
    /**
43
     * Sets HTTP client.
44
     * Returns the current object.
45
     *
46
     * @param HttpClient    $httpClient     HTTP client.
47
     *
48
     * @return self
49
     */
50 21
    private function setHttpClient(HttpClient $httpClient)
51
    {
52 21
        $this->httpClient = $httpClient;
53 21
        return $this;
54
    }
55
56
    /**
57
     * Gets HTTP client.
58
     *
59
     * @return HttpClient
60
     */
61 21
    protected function getHttpClient()
62
    {
63 21
        return $this->httpClient;
64
    }
65
66
    /**
67
     * Gets base currency.
68
     *
69
     * @return string
70
     */
71 6
    protected function getBaseCode()
72
    {
73 6
        return $this->baseCode;
74
    }
75
}
76