Completed
Pull Request — master (#53)
by Julien
02:22
created

HydraPaginatedCollection::__construct()   B

Complexity

Conditions 5
Paths 16

Size

Total Lines 20
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 20
rs 8.8571
cc 5
eloc 10
nc 16
nop 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A HydraPaginatedCollection::getTotalItems() 0 4 2
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
        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
        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
        return $this->getExtraProperty('hydra:nextPage');
40
    }
41
42
    /**
43
     * Returns total item count.
44
     *
45
     * @return int
46
     */
47
    public function getTotalItems()
48
    {
49
        return $this->getExtraProperty('hydra:totalItems') ?: 0;
50
    }
51
}
52