Pagination   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 3
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 64
wmc 11
lcom 3
cbo 0
ccs 28
cts 28
cp 1
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getPageSize() 0 4 1
A getPageCount() 0 4 1
A getTotalItems() 0 4 1
B __construct() 0 12 5
A setPageSize() 0 7 1
A setPageCount() 0 7 1
A setTotalItems() 0 7 1
1
<?php
2
namespace ApigilityClient\Resource;
3
4
final class Pagination
5
{
6
7
    const PAGE_SIZE   = 'page_size';
8
    const PAGE_COUNT  = 'page_count';
9
    const TOTAL_ITEMS = 'total_items';
10
11
    private $pageSize;
12
    private $pageCount;
13
    private $totalItems;
14
15 5
    public function __construct(array $data = null)
16
    {
17 5
        if (! empty($data)) {
18 5
            $pageSize   = (int) isset($data[self::PAGE_SIZE]) ? $data[self::PAGE_SIZE] : 0;
19 5
            $pageCount  = (int) isset($data[self::PAGE_COUNT]) ? $data[self::PAGE_COUNT] : 0;
20 5
            $totalItems = (int) isset($data[self::TOTAL_ITEMS]) ? $data[self::TOTAL_ITEMS] : 0;
21
22 5
            $this->setPageSize($pageSize)
23 5
                 ->setPageCount($pageCount)
24 5
                 ->setTotalItems($totalItems);
25 5
        }
26 5
    }
27
28 5
    public function setPageSize($input)
29
    {
30 5
        $input = (int) $input;
31 5
        $this->pageSize = $input;
32
33 5
        return $this;
34
    }
35
36 3
    public function getPageSize()
37
    {
38 3
        return $this->pageSize;
39
    }
40
41 5
    public function setPageCount($input)
42
    {
43 5
        $input = (int) $input;
44 5
        $this->pageCount = $input;
45
46 5
        return $this;
47
    }
48
49 1
    public function getPageCount()
50
    {
51 1
        return $this->pageCount;
52
    }
53
54 5
    public function setTotalItems($input)
55
    {
56 5
        $input = (int) $input;
57 5
        $this->totalItems = $input;
58
59 5
        return $this;
60
    }
61
62 1
    public function getTotalItems()
63
    {
64 1
        return $this->totalItems;
65
    }
66
67
}
68