Passed
Pull Request — master (#269)
by Christopher
03:18
created

ODataURLCollection::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 3
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace POData\ObjectModel;
6
7
/**
8
 * Class ODataURLCollection represent collection of links for $links request.
9
 */
10
class ODataURLCollection
11
{
12
    /**
13
     * Array of ODataURL.
14
     *
15
     * @var ODataURL[]
16
     */
17
    private $urls = [];
18
    /**
19
     * Enter URL to next page, if pagination is enabled.
20
     *
21
     * @var ODataLink|null
22
     */
23
    private $nextPageLink = null;
24
    /**
25
     * Enter url Count if inlineCount is requested.
26
     *
27
     * @var int|null
28
     */
29
    private $count = null;
30
31
    /**
32
     * ODataURLCollection constructor.
33
     * @param ODataURL[] $urls
34
     * @param ODataLink  $nextPageLink
35
     * @param int        $count
36
     */
37
    public function __construct(array $urls = [], ODataLink $nextPageLink = null, int $count = null)
38
    {
39
        $this
40
            ->setUrls($urls)
41
            ->setNextPageLink($nextPageLink)
42
            ->setCount($count);
43
    }
44
    /**
45
     * @return ODataURL[]
46
     */
47
    public function getUrls(): array
48
    {
49
        return $this->urls;
50
    }
51
52
    /**
53
     * @param  ODataURL[]         $urls
54
     * @return ODataURLCollection
55
     */
56
    public function setUrls(array $urls): ODataURLCollection
57
    {
58
        $this->urls = $urls;
59
        return $this;
60
    }
61
62
    /**
63
     * @return ODataLink|null
64
     */
65
    public function getNextPageLink(): ?ODataLink
66
    {
67
        return $this->nextPageLink;
68
    }
69
70
    /**
71
     * @param  ODataLink|null     $nextPageLink
72
     * @return ODataURLCollection
73
     */
74
    public function setNextPageLink(?ODataLink $nextPageLink): ODataURLCollection
75
    {
76
        $this->nextPageLink = $nextPageLink;
77
        return $this;
78
    }
79
80
    /**
81
     * @return int|null
82
     */
83
    public function getCount(): ?int
84
    {
85
        return $this->count;
86
    }
87
88
    /**
89
     * @param  int|null           $count
90
     * @return ODataURLCollection
91
     */
92
    public function setCount(?int $count): ODataURLCollection
93
    {
94
        $this->count = $count;
95
        return $this;
96
    }
97
}
98