Slot::leave()   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
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace Parking\Domain;
3
4
class Slot
5
{
6
7
    /**
8
     * @var null|Car
9
     */
10
    private $car;
11
12
    /**
13
     * Slot constructor.
14
     * @param Car|null $car
15
     */
16
    public function __construct(Car $car = null)
17
    {
18
        $this->car = $car;
19
    }
20
21
22
    /**
23
     *
24
     * @return bool
25
     */
26
    public function available()
27
    {
28
        return empty ($this->car);
29
    }
30
31
    public function leave()
32
    {
33
        $this->car = null;
34
    }
35
36
    /**
37
     * @param Car $car
38
     */
39
    public function addCar(Car $car)
40
    {
41
        $this->car = $car;
42
    }
43
44
    public function getCar()
45
    {
46
        return $this->car;
47
    }
48
49
}