Passed
Pull Request — master (#12)
by Laurens
01:27
created

Seat::getValue()   B

Complexity

Conditions 7
Paths 64

Size

Total Lines 29
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 7
eloc 14
c 1
b 0
f 0
nc 64
nop 0
dl 0
loc 29
rs 8.8333
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LauLamanApps\ApplePassbook\MetaData\SemanticTag;
6
7
class Seat
8
{
9
    private ?string $description;
10
    private ?string $identifier;
11
    private ?string $number;
12
    private ?string $row;
13
    private ?string $section;
14
    private ?string $type;
15
16
    public function __construct(
17
        ?string $description,
18
        ?string $identifier,
19
        ?string $number,
20
        ?string $row,
21
        ?string $section,
22
        ?string $type
23
    ) {
24
        $this->description = $description;
25
        $this->identifier = $identifier;
26
        $this->number = $number;
27
        $this->row = $row;
28
        $this->section = $section;
29
        $this->type = $type;
30
    }
31
32
    public function getValue()
33
    {
34
        $data = [];
35
36
        if (isset($this->description)) {
37
            $data['seatDescription'] = $this->description;
38
        }
39
40
        if (isset($this->identifier)) {
41
            $data['seatIdentifier'] = $this->identifier;
42
        }
43
44
        if (isset($this->number)) {
45
            $data['seatNumber'] = $this->number;
46
        }
47
48
        if (isset($this->row)) {
49
            $data['seatRow'] = $this->row;
50
        }
51
52
        if (isset($this->section)) {
53
            $data['seatSection'] = $this->section;
54
        }
55
56
        if (isset($this->type)) {
57
            $data['seatType'] = $this->type;
58
        }
59
60
        return $data;
61
    }
62
}