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

Seats::getKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LauLamanApps\ApplePassbook\MetaData\SemanticTag;
6
7
use LauLamanApps\ApplePassbook\MetaData\SemanticTag;
8
9
class Seats implements SemanticTag
10
{
11
    /** @var Seat[]  */
12
    private array $seats = [];
13
14
    public function __construct(Seat $seat = null)
15
    {
16
        if (isset($seat)){
17
            $this->addSeat($seat);
18
        }
19
    }
20
21
    public function addSeat(Seat $seat): void
22
    {
23
        $this->seats[] = $seat;
24
    }
25
26
    public function getKey(): string
27
    {
28
        return 'seats';
29
    }
30
    /**
31
     * @return array<array<string, string>>
32
     */
33
    public function getValue(): array
34
    {
35
        $seats = [];
36
37
        foreach ($this->seats as $seat) {
38
            $seats[] = $seat->getValue();
39
        }
40
41
        return $seats;
42
    }
43
}