Completed
Push — master ( fd6b18...202a78 )
by Nikola
03:09
created

Configuration::getCurrencyCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/*
3
 * This file is part of the Exchange Rate package, an RunOpenCode project.
4
 *
5
 * (c) 2016 RunOpenCode
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace RunOpenCode\ExchangeRate;
11
12
use RunOpenCode\ExchangeRate\Utils\CurrencyCodeUtil;
13
14
/**
15
 * Class Configuration
16
 *
17
 * Configuration defines which rates should be acquired from which source, and holds additional custom cofiguration
18
 * parameters, if required.
19
 *
20
 * @package RunOpenCode\ExchangeRate
21
 */
22
class Configuration
23
{
24
    /**
25
     * @var string
26
     */
27
    private $currencyCode;
28
29
    /**
30
     * @var string
31
     */
32
    private $rateType;
33
34
    /**
35
     * @var string
36
     */
37
    private $sourceName;
38
39
    /**
40
     * @var array
41
     */
42
    private $extraConfiguration;
43
44 8
    public function __construct($currencyCode, $rateType, $sourceName, array $extraConfiguration = array())
45
    {
46 8
        $this->currencyCode = CurrencyCodeUtil::clean($currencyCode);
47 8
        $this->rateType = $rateType;
48 8
        $this->sourceName = $sourceName;
49 8
        $this->extraConfiguration = $extraConfiguration;
50 8
    }
51
52
    /**
53
     * Get configured currency code.
54
     *
55
     * @return string
56
     */
57 4
    public function getCurrencyCode()
58
    {
59 4
        return $this->currencyCode;
60
    }
61
62
    /**
63
     * Get configured rate type.
64
     *
65
     * @return string
66
     */
67 4
    public function getRateType()
68
    {
69 4
        return $this->rateType;
70
    }
71
72
    /**
73
     * Get configured source.
74
     *
75
     * @return string
76
     */
77 2
    public function getSourceName()
78
    {
79 2
        return $this->sourceName;
80
    }
81
82
    /**
83
     * Get additional configuration paramaters, if applicable.
84
     *
85
     * @return array
86
     */
87
    public function getExtraConfiguration()
88
    {
89
        return $this->extraConfiguration;
90
    }
91
}
92