Completed
Push — master ( ad594c...e358da )
by Neomerx
02:28
created

PaginatedData::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 7
cts 7
cp 1
rs 9.4285
cc 1
eloc 6
nc 1
nop 5
crap 1
1
<?php namespace Limoncello\Models;
2
3
/**
4
 * Copyright 2015-2016 [email protected] (www.neomerx.com)
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 * http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
use Limoncello\Models\Contracts\PaginatedDataInterface;
20
21
/**
22
 * @package Limoncello\Models
23
 */
24
class PaginatedData implements PaginatedDataInterface
25
{
26
    /** @var  mixed */
27
    private $data;
28
29
    /** @var  bool */
30
    private $isCollection;
31
32
    /** @var  bool */
33
    private $hasMoreItems;
34
35
    /** @var  int|null */
36
    private $offset;
37
38
    /** @var  int|null */
39
    private $size;
40
41
    /**
42
     * @param mixed    $data
43
     * @param bool     $isCollection
44
     * @param bool     $hasMoreItems
45
     * @param int|null $offset
46
     * @param int|null $size
47
     */
48 2
    public function __construct($data, $isCollection = false, $hasMoreItems = false, $offset = null, $size = null)
49
    {
50 2
        $this->data         = $data;
51 2
        $this->isCollection = $isCollection;
52 2
        $this->hasMoreItems = $hasMoreItems;
53 2
        $this->offset       = $offset;
54 2
        $this->size         = $size;
55 2
    }
56
57
    /**
58
     * @inheritdoc
59
     */
60 2
    public function getData()
61
    {
62 2
        return $this->data;
63
    }
64
65
    /**
66
     * @inheritdoc
67
     */
68 1
    public function isCollection()
69
    {
70 1
        return $this->isCollection;
71
    }
72
73
    /**
74
     * @inheritdoc
75
     */
76 1
    public function hasMoreItems()
77
    {
78 1
        return $this->hasMoreItems;
79
    }
80
81
    /**
82
     * @inheritdoc
83
     */
84 1
    public function getOffset()
85
    {
86 1
        return $this->offset;
87
    }
88
89
    /**
90
     * @inheritdoc
91
     */
92 1
    public function getSize()
93
    {
94 1
        return $this->size;
95
    }
96
}
97