VehicleInspection::getLastInspection()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: marek
5
 * Date: 19.11.15
6
 * Time: 09:36.
7
 */
8
namespace Madkom\RegistryApplication\Domain\CarManagement\VehicleInspection;
9
10
class VehicleInspection
11
{
12
    /** @var string */
13
    private $id;
14
15
    /** @var \DateTime */
16
    private $lastInspection;
17
18
    /** @var \DateTime */
19
    private $upcomingInspection;
20
21
    /**
22
     * VehicleInspection constructor.
23
     *
24
     * @param $id
25
     * @param $lastInspection
26
     * @param $upcomingInspection
27
     */
28
    private function __construct($id, $lastInspection, $upcomingInspection)
29
    {
30
        $this->id = $id;
31
        $this->lastInspection = $lastInspection;
32
        $this->upcomingInspection = $upcomingInspection;
33
    }
34
35
    /**
36
     * @param $id
37
     * @param $lastInspection
38
     * @param $upcomingInspection
39
     *
40
     * @throws \Madkom\RegistryApplication\Domain\CarManagement\CarExceptions\InvalidDatesException
41
     *
42
     * @return \Madkom\RegistryApplication\Domain\CarManagement\VehicleInspection\VehicleInspection
43
     */
44
    public static function createVehicleInspection($id, $lastInspection, $upcomingInspection)
45
    {
46
        return new self(
47
            $id,
48
            new \DateTime($lastInspection),
49
            new \DateTime($upcomingInspection)
50
        );
51
    }
52
53
    /** @return \DateTime $this->lastInspection */
54
    public function getLastInspection()
55
    {
56
        return $this->lastInspection;
57
    }
58
59
    /** @return \DateTime $this->upcomingInspection */
60
    public function getUpcomingInspection()
61
    {
62
        return $this->upcomingInspection;
63
    }
64
65
    /** @return string $this->id */
66
    public function getId()
67
    {
68
        return $this->id;
69
    }
70
}
71