1 | <?php |
||
2 | |||
3 | namespace Igorsgm\Ghost\Models; |
||
4 | |||
5 | class Meta extends BaseModel |
||
6 | { |
||
7 | /** |
||
8 | * @var array |
||
9 | */ |
||
10 | public $pagination; |
||
11 | |||
12 | 53 | public function __construct(array $data = []) |
|
13 | { |
||
14 | 53 | $this->pagination = (object) ($data['pagination'] ?? []); |
|
0 ignored issues
–
show
|
|||
15 | } |
||
16 | |||
17 | /** |
||
18 | * @return int |
||
19 | */ |
||
20 | 5 | public function page() |
|
21 | { |
||
22 | 5 | return $this->pagination->page ?? null; |
|
23 | } |
||
24 | |||
25 | /** |
||
26 | * @return int |
||
27 | */ |
||
28 | 5 | public function limit() |
|
29 | { |
||
30 | 5 | return $this->pagination->limit ?? null; |
|
31 | } |
||
32 | |||
33 | /** |
||
34 | * @return int |
||
35 | */ |
||
36 | 5 | public function pages() |
|
37 | { |
||
38 | 5 | return $this->pagination->pages ?? null; |
|
39 | } |
||
40 | |||
41 | /** |
||
42 | * @return int |
||
43 | */ |
||
44 | 5 | public function total() |
|
45 | { |
||
46 | 5 | return $this->pagination->total ?? null; |
|
47 | } |
||
48 | |||
49 | /** |
||
50 | * @return bool |
||
51 | */ |
||
52 | 6 | public function hasNext() |
|
53 | { |
||
54 | 6 | return ! empty($this->pagination->next); |
|
55 | } |
||
56 | |||
57 | /** |
||
58 | * @return int |
||
59 | */ |
||
60 | 6 | public function next() |
|
61 | { |
||
62 | 6 | return $this->pagination->next ?? null; |
|
63 | } |
||
64 | |||
65 | /** |
||
66 | * @return bool |
||
67 | */ |
||
68 | 6 | public function hasPrev() |
|
69 | { |
||
70 | 6 | return ! empty($this->pagination->prev); |
|
71 | } |
||
72 | |||
73 | /** |
||
74 | * @return int |
||
75 | */ |
||
76 | 6 | public function prev() |
|
77 | { |
||
78 | 6 | return $this->pagination->prev ?? null; |
|
79 | } |
||
80 | } |
||
81 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..