Completed
Push — master ( f46316...620406 )
by Nikola
07:51
created

Rate::setSourceName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 9.4286
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
3
namespace RunOpenCode\Bundle\ExchangeRate\Model;
4
5
use RunOpenCode\ExchangeRate\Contract\RateInterface;
6
use RunOpenCode\ExchangeRate\Model\Rate as BaseRate;
7
8
class Rate extends BaseRate
9
{
10
    /**
11
     * Set source name.
12
     *
13
     * @param string $sourceName
14
     * @return Rate Fluent interface.
15
     */
16
    public function setSourceName($sourceName)
17
    {
18
        $this->sourceName = $sourceName;
19
        return $this;
20
    }
21
22
    /**
23
     * Set value.
24
     *
25
     * @param float $value
26
     * @return Rate Fluent interface.
27
     */
28
    public function setValue($value)
29
    {
30
        $this->value = $value;
31
        return $this;
32
    }
33
34
    /**
35
     * Set currency code.
36
     *
37
     * @param string $currencyCode
38
     * @return Rate Fluent interface.
39
     */
40
    public function setCurrencyCode($currencyCode)
41
    {
42
        $this->currencyCode = $currencyCode;
43
        return $this;
44
    }
45
46
    /**
47
     * Set rate type.
48
     *
49
     * @param string $rateType
50
     * @return Rate Fluent interface.
51
     */
52
    public function setRateType($rateType)
53
    {
54
        $this->rateType = $rateType;
55
        return $this;
56
    }
57
58
    /**
59
     * Set date.
60
     *
61
     * @param \DateTime $date
62
     * @return Rate Fluent interface.
63
     */
64
    public function setDate(\DateTime $date)
65
    {
66
        $this->date = $date;
67
        return $this;
68
    }
69
70
    /**
71
     * Set base currency code.
72
     *
73
     * @param string $baseCurrencyCode
74
     * @return Rate Fluent interface.
75
     */
76
    public function setBaseCurrencyCode($baseCurrencyCode)
77
    {
78
        $this->baseCurrencyCode = $baseCurrencyCode;
79
        return $this;
80
    }
81
82
    /**
83
     * Set created date.
84
     *
85
     * @param \DateTime $createdAt
86
     * @return Rate Fluent interface.
87
     */
88
    public function setCreatedAt(\DateTime $createdAt)
89
    {
90
        $this->createdAt = $createdAt;
91
        return $this;
92
    }
93
94
    /**
95
     * Set last modification date.
96
     *
97
     * @param \DateTime $modifiedAt
98
     * @return Rate Fluent interface.
99
     */
100
    public function setModifiedAt(\DateTime $modifiedAt)
101
    {
102
        $this->modifiedAt = $modifiedAt;
103
        return $this;
104
    }
105
106
    public static function fromRateInterface(RateInterface $rate)
107
    {
108
        return new static(
109
            $rate->getSourceName(),
110
            $rate->getValue(),
111
            $rate->getCurrencyCode(),
112
            $rate->getRateType(),
113
            $rate->getDate(),
114
            $rate->getBaseCurrencyCode(),
115
            $rate->getCreatedAt(),
0 ignored issues
show
Bug introduced by
The method getCreatedAt() does not seem to exist on object<RunOpenCode\Excha...Contract\RateInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
116
            $rate->getModifiedAt()
0 ignored issues
show
Bug introduced by
The method getModifiedAt() does not seem to exist on object<RunOpenCode\Excha...Contract\RateInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
117
        );
118
    }
119
}
120