LeaseExpiryObject::setExpiryDate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace ZpgRtf\Objects;
4
5
use ZpgRtf\Helpers\DateTimeHelper;
6
7
/**
8
 * The expiry of leasehold tenure can be expressed as the actual expiry date or the number of years remaining on the
9
 * lease.
10
 */
11
class LeaseExpiryObject implements \JsonSerializable
12
{
13
    /** @var null|DateTimeHelper */
14
    private $expiryDate;
15
16
    /**
17
     * @return null|DateTimeHelper
18
     */
19 2
    public function getExpiryDate()
20
    {
21 2
        return $this->expiryDate;
22
    }
23
24
    /**
25
     * @param DateTimeHelper $expiryDate
26
     *
27
     * @return LeaseExpiryObject
28
     */
29 1
    public function setExpiryDate(DateTimeHelper $expiryDate): self
30
    {
31 1
        $this->expiryDate = $expiryDate;
32
33 1
        return $this;
34
    }
35
36
    /** {@inheritDoc} */
37 1
    public function jsonSerialize(): array
38
    {
39 1
        return array_filter([
40 1
            'expiry_date' => $this->getExpiryDate()
41
        ]);
42
    }
43
}
44