Completed
Branch develop (a0a623)
by Romain
02:33
created

Airport   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 72
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A setTerminal() 0 6 1
A setGate() 0 6 1
A jsonSerialize() 0 11 1
1
<?php
2
namespace Kerox\Messenger\Message\Attachment\Template\Airline;
3
4
class Airport implements \JsonSerializable
5
{
6
7
    /**
8
     * @var string
9
     */
10
    protected $airportCode;
11
12
    /**
13
     * @var string
14
     */
15
    protected $city;
16
17
    /**
18
     * @var string
19
     */
20
    protected $terminal;
21
22
    /**
23
     * @var string
24
     */
25
    protected $gate;
26
27
    /**
28
     * Airport constructor.
29
     *
30
     * @param string $airportCode
31
     * @param string $city
32
     */
33
    public function __construct(string $airportCode, string $city)
34
    {
35
        $this->airportCode = $airportCode;
36
        $this->city = $city;
37
    }
38
39
    /**
40
     * @param string $terminal
41
     * @return Airport
42
     */
43
    public function setTerminal(string $terminal): Airport
44
    {
45
        $this->terminal = $terminal;
46
47
        return $this;
48
    }
49
50
    /**
51
     * @param string $gate
52
     * @return Airport
53
     */
54
    public function setGate(string $gate): Airport
55
    {
56
        $this->gate = $gate;
57
58
        return $this;
59
    }
60
61
    /**
62
     * @return array
63
     */
64
    public function jsonSerialize(): array
65
    {
66
        $json = [
67
            'airport_code' => $this->airportCode,
68
            'city' => $this->city,
69
            'terminal' => $this->terminal,
70
            'gate' => $this->gate,
71
        ];
72
73
        return array_filter($json);
74
    }
75
}