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

Seats   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getValue() 0 9 2
A addSeat() 0 3 1
A getKey() 0 3 1
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 addSeat(Seat $seat): void
15
    {
16
        $this->seats[] = $seat;
17
    }
18
19
    public function getKey(): string
20
    {
21
        return 'seats';
22
    }
23
24
    public function getValue(): array
25
    {
26
        $seats = [];
27
28
        foreach ($this->seats as $seat) {
29
            $seats[] = $seat->getValue();
30
        }
31
32
        return $seats;
33
    }
34
}