Mandate::isActive()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Lendable\GoCardlessEnterpriseBundle\Entity;
4
5
use Lendable\GoCardlessEnterpriseBundle\Enum\MandateState;
6
7
class Mandate extends \Lendable\GoCardlessEnterprise\Model\Mandate
8
{
9
    /**
10
     * @var \DateTimeInterface
11
     */
12
    protected $updated;
13
14
    /**
15
     * @return \DateTimeInterface
16
     */
17
    public function getUpdated()
18
    {
19
        return $this->updated;
20
    }
21
22
    /**
23
     * @param \DateTimeInterface $updated
24
     */
25
    public function setUpdated(\DateTimeInterface $updated)
26
    {
27
        $this->updated = $updated;
28
    }
29
30
    /**
31
     * @var string
32
     */
33
    protected $pdfPath;
34
35
    /**
36
     * @param string $path
37
     */
38
    public function setPdfPath($path)
39
    {
40
        $this->pdfPath = $path;
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function getPdfPath()
47
    {
48
        return $this->pdfPath;
49
    }
50
51
    public function toArray()
52
    {
53
        $arr = parent::toArray();
54
        if (array_key_exists('pdfPath', $arr)) {
55
            unset($arr['pdfPath']);
56
        }
57
58
        return $arr;
59
    }
60
61
    public function fromArray($data)
62
    {
63
        parent::fromArray($data);
64
        $this->setCreatedAt(new \DateTime($this->getCreatedAt()));
0 ignored issues
show
Bug introduced by
new DateTime($this->getCreatedAt()) of type DateTime is incompatible with the type string expected by parameter $createdAt of Lendable\GoCardlessEnter...l\Model::setCreatedAt(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

64
        $this->setCreatedAt(/** @scrutinizer ignore-type */ new \DateTime($this->getCreatedAt()));
Loading history...
65
    }
66
67
    /**
68
     * @return bool
69
     */
70
    public function isActive()
71
    {
72
        return in_array($this->getStatus(), MandateState::getActiveStates());
73
    }
74
}
75