Completed
Push — master ( e3081b...b3412c )
by Nikola
03:22
created

Configuration   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 86
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 6
c 4
b 0
f 0
lcom 0
cbo 1
dl 0
loc 86
ccs 0
cts 28
cp 0
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getCurrencyCode() 0 4 1
A getRateType() 0 4 1
A getSource() 0 4 1
A getAlias() 0 4 1
A getExtraConfiguration() 0 4 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 $source;
38
39
    /**
40
     * @var string
41
     */
42
    private $alias;
43
44
    /**
45
     * @var array
46
     */
47
    private $extraConfiguration;
48
49
    public function __construct($currencyCode, $rateType, $source, $alias = null, array $extraConfiguration = array())
50
    {
51
        $this->currencyCode = CurrencyCodeUtil::clean($currencyCode);
52
        $this->rateType = $rateType;
53
        $this->source = $source;
54
        $this->alias = $alias;
55
        $this->extraConfiguration = $extraConfiguration;
56
    }
57
58
    /**
59
     * Get configured currency code.
60
     *
61
     * @return string
62
     */
63
    public function getCurrencyCode()
64
    {
65
        return $this->currencyCode;
66
    }
67
68
    /**
69
     * Get configured rate type.
70
     *
71
     * @return string
72
     */
73
    public function getRateType()
74
    {
75
        return $this->rateType;
76
    }
77
78
    /**
79
     * Get configured source.
80
     *
81
     * @return string
82
     */
83
    public function getSource()
84
    {
85
        return $this->source;
86
    }
87
88
    /**
89
     * Get alias.
90
     *
91
     * @return null|string
92
     */
93
    public function getAlias()
94
    {
95
        return $this->alias;
96
    }
97
98
    /**
99
     * Get additional configuration paramaters, if applicable.
100
     *
101
     * @return array
102
     */
103
    public function getExtraConfiguration()
104
    {
105
        return $this->extraConfiguration;
106
    }
107
}
108