Slot   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A available() 0 4 1
A leave() 0 4 1
A addCar() 0 4 1
A getCar() 0 4 1
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
}