ListObject::getData()   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
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Viktoras\Scryfall\Entities;
4
5
use Viktoras\Scryfall\Enums\Objects;
6
7
class ListObject extends AbstractObject
8
{
9
    /**
10
     * @var array
11
     */
12
    private $data;
13
14
    /**
15
     * @var bool
16
     */
17
    private $hasMore;
18
19
    /**
20
     * @var string|null
21
     */
22
    private $nextPage;
23
24
    /**
25
     * @var string|null
26
     */
27
    private $totalCards;
28
29
    /**
30
     * @var array
31
     */
32
    private $warnings;
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    protected function acceptsObject(): string
38
    {
39
        return Objects::LIST;
40
    }
41
42
    /**
43
     * @return ObjectInterface[]
44
     */
45
    public function getObjects(): array
46
    {
47
        $objectFactory = new ObjectFactory();
48
49
        $objects = [];
50
51
        foreach ($this->data as $data) {
52
            $objects[] = $objectFactory->makeFromArray($data);
53
        }
54
55
        return $objects;
56
    }
57
58
    public function getData(): array
59
    {
60
        return $this->data;
61
    }
62
63
    public function setData(array $data): void
64
    {
65
        $this->data = $data;
66
    }
67
68
    public function hasMore(): bool
69
    {
70
        return $this->hasMore;
71
    }
72
73
    public function setHasMore(bool $hasMore): void
74
    {
75
        $this->hasMore = $hasMore;
76
    }
77
78
    public function getNextPage(): ?string
79
    {
80
        return $this->nextPage;
81
    }
82
83
    public function setNextPage(?string $nextPage): void
84
    {
85
        $this->nextPage = $nextPage;
86
    }
87
88
    public function getTotalCards(): ?string
89
    {
90
        return $this->totalCards;
91
    }
92
93
    public function setTotalCards(?string $totalCards): void
94
    {
95
        $this->totalCards = $totalCards;
96
    }
97
98
    public function getWarnings(): array
99
    {
100
        return $this->warnings;
101
    }
102
103
    public function setWarnings(array $warnings): void
104
    {
105
        $this->warnings = $warnings;
106
    }
107
}
108