Completed
Pull Request — master (#74)
by Julien
04:30
created

HydraPaginatedCollection   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 40
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getFirstPage() 0 3 1
A getTotalItems() 0 3 2
A getLastPage() 0 3 1
A getNextPage() 0 3 1
1
<?php
2
3
namespace Mapado\RestClientSdk\Collection;
4
5
/**
6
 * Class HydraPaginatedCollection
7
 *
8
 * @author Florent Clerc <[email protected]>
9
 */
10
class HydraPaginatedCollection extends Collection
11
{
12
    /**
13
     * Returns first page URI.
14
     *
15
     * @return string|null
16
     */
17
    public function getFirstPage()
18
    {
19 1
        return $this->getExtraProperty('hydra:firstPage');
20
    }
21
22
    /**
23
     * Returns last page URI.
24
     *
25
     * @return string|null
26
     */
27
    public function getLastPage()
28
    {
29 1
        return $this->getExtraProperty('hydra:lastPage');
30
    }
31
32
    /**
33
     * Returns next page URI.
34
     *
35
     * @return string|null
36
     */
37
    public function getNextPage()
38
    {
39 1
        return $this->getExtraProperty('hydra:nextPage');
40
    }
41
42
    /**
43
     * Returns total item count.
44
     *
45
     * @return int
46
     */
47
    public function getTotalItems()
48
    {
49 1
        return $this->getExtraProperty('hydra:totalItems') ?: 0;
50
    }
51
}
52