Completed
Push — master ( bf73c4...f46316 )
by Nikola
02:17
created

Rate   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 82
ccs 0
cts 32
cp 0
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A setSourceName() 0 4 1
A setValue() 0 4 1
A setCurrencyCode() 0 4 1
A setRateType() 0 4 1
A setDate() 0 4 1
A setBaseCurrencyCode() 0 4 1
A setCreatedAt() 0 4 1
A setModifiedAt() 0 4 1
1
<?php
2
3
namespace RunOpenCode\Bundle\ExchangeRate\Model;
4
5
use RunOpenCode\ExchangeRate\Model\Rate as BaseRate;
6
use RunOpenCode\ExchangeRate\Utils\CurrencyCode;
7
8
class Rate extends BaseRate
9
{
10
    /**
11
     * Set source name.
12
     *
13
     * @param string $sourceName
14
     */
15
    public function setSourceName($sourceName)
16
    {
17
        $this->sourceName = $sourceName;
18
    }
19
20
    /**
21
     * Set value.
22
     *
23
     * @param float $value
24
     */
25
    public function setValue($value)
26
    {
27
        $this->value = $value;
28
    }
29
30
    /**
31
     * Set currency code.
32
     *
33
     * @param string $currencyCode
34
     */
35
    public function setCurrencyCode($currencyCode)
36
    {
37
        $this->currencyCode = CurrencyCode::validate($currencyCode);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $this->currencyCode is correct as \RunOpenCode\ExchangeRat...validate($currencyCode) (which targets RunOpenCode\ExchangeRate...urrencyCode::validate()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
38
    }
39
40
    /**
41
     * Set rate type.
42
     *
43
     * @param string $rateType
44
     */
45
    public function setRateType($rateType)
46
    {
47
        $this->rateType = $rateType;
48
    }
49
50
    /**
51
     * Set date.
52
     *
53
     * @param \DateTime $date
54
     */
55
    public function setDate(\DateTime $date)
56
    {
57
        $this->date = $date;
58
    }
59
60
    /**
61
     * Set base currency code.
62
     *
63
     * @param string $baseCurrencyCode
64
     */
65
    public function setBaseCurrencyCode($baseCurrencyCode)
66
    {
67
        $this->baseCurrencyCode = CurrencyCode::validate($baseCurrencyCode);;
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $this->baseCurrencyCode is correct as \RunOpenCode\ExchangeRat...date($baseCurrencyCode) (which targets RunOpenCode\ExchangeRate...urrencyCode::validate()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
68
    }
69
70
    /**
71
     * Set created date.
72
     *
73
     * @param \DateTime $createdAt
74
     */
75
    public function setCreatedAt(\DateTime $createdAt)
76
    {
77
        $this->createdAt = $createdAt;
78
    }
79
80
    /**
81
     * Set last modification date.
82
     *
83
     * @param \DateTime $modifiedAt
84
     */
85
    public function setModifiedAt(\DateTime $modifiedAt)
86
    {
87
        $this->modifiedAt = $modifiedAt;
88
    }
89
}
90