Completed
Push — master ( b2cf50...2dc6b4 )
by Simonas
12:24
created

CurrencyDocument::__construct()   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 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 0
cts 2
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 2
1
<?php
2
3
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[email protected]>
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 ONGR\CurrencyExchangeBundle\Document;
13
14
use ONGR\ElasticsearchBundle\Annotation as ES;
15
use ONGR\ElasticsearchBundle\Collection\Collection;
16
17
/**
18
 * Stores currency rates.
19
 *
20
 * @ES\Document(type="currency")
21
 */
22
class CurrencyDocument
23
{
24
    /**
25
     * @var RatesObject
26
     *
27
     * @ES\Embedded(class="ONGRCurrencyExchangeBundle:RatesObject", multiple=true)
28
     */
29
    private $rates;
30
31
    /**
32
     * @var \DateTime
33
     *
34
     * @ES\Property(type="date")
35
     */
36
    private $createdAt;
37
38
    /**
39
     * CurrencyDocument constructor.
40
     */
41
    public function __construct()
42
    {
43
        $this->rates = new Collection();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \ONGR\ElasticsearchB...Collection\Collection() of type object<ONGR\Elasticsearc...\Collection\Collection> is incompatible with the declared type object<ONGR\CurrencyExch...e\Document\RatesObject> of property $rates.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
44
        $this->createdAt = new \DateTime();
45
    }
46
47
    /**
48
     * @return RatesObject
49
     */
50
    public function getRates()
51
    {
52
        return $this->rates;
53
    }
54
55
    /**
56
     * @param RatesObject $rates
57
     */
58
    public function setRates($rates)
59
    {
60
        $this->rates = $rates;
61
    }
62
63
    /**
64
     * @param RatesObject $rate
65 3
     */
66
    public function addRate($rate)
67 3
    {
68 3
        $this->rates[] = $rate;
69
    }
70
71
    /**
72
     * @return \DateTime
73
     */
74
    public function getCreatedAt()
75
    {
76
        return $this->createdAt;
77
    }
78
79
    /**
80
     * @param \DateTime $createdAt
81
     */
82
    public function setCreatedAt($createdAt)
83
    {
84
        $this->createdAt = $createdAt;
85
    }
86
}
87