Completed
Push — symfony3-fqcn ( 04e8c2...ea8d6b )
by Kamil
18:56
created

ExchangeRate   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 82
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A getRatio() 0 4 1
A setRatio() 0 6 1
A getSourceCurrency() 0 4 1
A setSourceCurrency() 0 4 1
A getTargetCurrency() 0 4 1
A setTargetCurrency() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Component\Currency\Model;
13
14
use Webmozart\Assert\Assert;
15
16
/**
17
 * @author Jan Góralski <[email protected]>
18
 */
19
class ExchangeRate implements ExchangeRateInterface
20
{
21
    /**
22
     * @var mixed
23
     */
24
    protected $id;
25
26
    /**
27
     * @var float
28
     */
29
    protected $ratio;
30
31
    /**
32
     * @var CurrencyInterface
33
     */
34
    protected $sourceCurrency;
35
36
    /**
37
     * @var CurrencyInterface
38
     */
39
    protected $targetCurrency;
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function getId()
45
    {
46
        return $this->id;
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function getRatio()
53
    {
54
        return $this->ratio;
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     *
60
     * @throws \InvalidArgumentException
61
     */
62
    public function setRatio($ratio)
63
    {
64
        Assert::float($ratio);
65
66
        $this->ratio = $ratio;
67
    }
68
69
    /**
70
     * {@inheritdoc}
71
     */
72
    public function getSourceCurrency()
73
    {
74
        return $this->sourceCurrency;
75
    }
76
77
    /**
78
     * {@inheritdoc}
79
     */
80
    public function setSourceCurrency(CurrencyInterface $currency)
81
    {
82
        $this->sourceCurrency = $currency;
83
    }
84
85
    /**
86
     * {@inheritdoc}
87
     */
88
    public function getTargetCurrency()
89
    {
90
        return $this->targetCurrency;
91
    }
92
93
    /**
94
     * {@inheritdoc}
95
     */
96
    public function setTargetCurrency(CurrencyInterface $currency)
97
    {
98
        $this->targetCurrency = $currency;
99
    }
100
}
101