Passed
Push — master ( f8b368...4df760 )
by Martin
05:42
created

Mandate   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 66
rs 10
c 0
b 0
f 0
wmc 8

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setPdfPath() 0 3 1
A setUpdated() 0 3 1
A isActive() 0 3 1
A toArray() 0 8 2
A fromArray() 0 4 1
A getUpdated() 0 3 1
A getPdfPath() 0 3 1
1
<?php
2
3
namespace Lendable\GoCardlessEnterpriseBundle\Entity;
4
5
class Mandate extends \Lendable\GoCardlessEnterprise\Model\Mandate
6
{
7
    /**
8
     * @var \DateTimeInterface
9
     */
10
    protected $updated;
11
12
    /**
13
     * @return \DateTimeInterface
14
     */
15
    public function getUpdated()
16
    {
17
        return $this->updated;
18
    }
19
20
    /**
21
     * @param \DateTimeInterface $updated
22
     */
23
    public function setUpdated(\DateTimeInterface $updated)
24
    {
25
        $this->updated = $updated;
26
    }
27
28
    /**
29
     * @var string
30
     */
31
    protected $pdfPath;
32
33
    /**
34
     * @param string $path
35
     */
36
    public function setPdfPath($path)
37
    {
38
        $this->pdfPath = $path;
39
    }
40
41
    /**
42
     * @return string
43
     */
44
    public function getPdfPath()
45
    {
46
        return $this->pdfPath;
47
    }
48
49
    public function toArray()
50
    {
51
        $arr = parent::toArray();
52
        if (array_key_exists('pdfPath', $arr)) {
53
            unset($arr['pdfPath']);
54
        }
55
56
        return $arr;
57
    }
58
59
    public function fromArray($data)
60
    {
61
        parent::fromArray($data);
62
        $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

62
        $this->setCreatedAt(/** @scrutinizer ignore-type */ new \DateTime($this->getCreatedAt()));
Loading history...
63
    }
64
65
    /**
66
     * @return bool
67
     */
68
    public function isActive()
69
    {
70
        return !in_array($this->getStatus(), ['failed', 'cancelled']);
71
    }
72
}
73