Passed
Push — master ( 04b2be...d426f2 )
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 = null,
18
        ?string $identifier = null,
19
        ?string $number = null,
20
        ?string $row = null,
21
        ?string $section = null,
22
        ?string $type = null
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
    /**
33
     * @return array<string, string>
34
     */
35
    public function getValue(): array
36
    {
37
        $data = [];
38
39
        if (isset($this->description)) {
40
            $data['seatDescription'] = $this->description;
41
        }
42
43
        if (isset($this->identifier)) {
44
            $data['seatIdentifier'] = $this->identifier;
45
        }
46
47
        if (isset($this->number)) {
48
            $data['seatNumber'] = $this->number;
49
        }
50
51
        if (isset($this->row)) {
52
            $data['seatRow'] = $this->row;
53
        }
54
55
        if (isset($this->section)) {
56
            $data['seatSection'] = $this->section;
57
        }
58
59
        if (isset($this->type)) {
60
            $data['seatType'] = $this->type;
61
        }
62
63
        return $data;
64
    }
65
}
66