Completed
Push — master ( 17fbce...9c0ecb )
by Nikola
02:12
created

Configuration   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 66
ccs 0
cts 26
cp 0
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 2
A getCurrencyCode() 0 4 1
A getRateType() 0 4 1
A getSource() 0 4 1
A getExtraConfiguration() 0 4 1
1
<?php
2
3
namespace RunOpenCode\ExchangeRate;
4
5
use RunOpenCode\ExchangeRate\Exception\UnknownCurrencyCodeException;
6
use RunOpenCode\ExchangeRate\Utils\CurrencyCode;
7
8
class Configuration
9
{
10
    /**
11
     * @var string
12
     */
13
    private $currencyCode;
14
15
    /**
16
     * @var string
17
     */
18
    private $rateType;
19
20
    /**
21
     * @var string
22
     */
23
    private $source;
24
25
    /**
26
     * @var array
27
     */
28
    private $extraConfiguration;
29
30
    public function __construct($currencyCode, $rateType, $source, array $extraConfiguration = array())
31
    {
32
        if (!CurrencyCode::exists($currencyCode)) {
33
            throw new UnknownCurrencyCodeException(sprintf('Unknown currency code "%s".', $currencyCode));
34
        }
35
36
        $this->currencyCode = $currencyCode;
37
        $this->rateType = $rateType;
38
        $this->source = $source;
39
        $this->extraConfiguration = $extraConfiguration;
40
    }
41
42
    /**
43
     * @return string
44
     */
45
    public function getCurrencyCode()
46
    {
47
        return $this->currencyCode;
48
    }
49
50
    /**
51
     * @return string
52
     */
53
    public function getRateType()
54
    {
55
        return $this->rateType;
56
    }
57
58
    /**
59
     * @return string
60
     */
61
    public function getSource()
62
    {
63
        return $this->source;
64
    }
65
66
    /**
67
     * @return array
68
     */
69
    public function getExtraConfiguration()
70
    {
71
        return $this->extraConfiguration;
72
    }
73
}
74