Team::getName()   A
last analyzed

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
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Eekes\VblApi\Entity;
5
6
class Team
7
{
8
    private string $id;
9
    private string $name;
10
    private GroupCollection $groups;
11
    private PlayerCollection $players;
12
    private StaffCollection $staff;
13
14
    public static function createFromResponse(\stdClass $response): self
15
    {
16
        $team = new self();
17
18
        $team->id = $response->guid;
19
        $team->name = $response->naam;
20
        $team->groups = GroupCollection::createFromArrayResponse($response->poules);
21
        $team->players = PlayerCollection::createFromArrayResponse($response->spelers ?? []);
22
        $team->staff = StaffCollection::createFromArrayResponse($response->tvlijst ?? []);
23
24
        return $team;
25
    }
26
27
    public function getId(): string
28
    {
29
        return $this->id;
30
    }
31
32
    public function getName(): string
33
    {
34
        return $this->name;
35
    }
36
37
    public function getGroups(): GroupCollection
38
    {
39
        return $this->groups;
40
    }
41
42
    public function getPlayers(): PlayerCollection
43
    {
44
        return $this->players;
45
    }
46
47
    public function getStaff(): StaffCollection
48
    {
49
        return $this->staff;
50
    }
51
}