VehicleInspection   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 61
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A createVehicleInspection() 0 8 1
A getLastInspection() 0 4 1
A getUpcomingInspection() 0 4 1
A getId() 0 4 1
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