Skip to content

Commit 0834c8c

Browse files
Fix pagination to be nullable as it is stated in the docs (#98)
* Fix pagination to be nullable as it is stated in the docs * Apply fixes from StyleCI --------- Co-authored-by: StyleCI Bot <[email protected]>
1 parent 0df11db commit 0834c8c

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

src/Models/Images/Image.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public static function parse($input): ?Image
276276
return null;
277277
}
278278

279-
return new self($input->id, $input->type, (property_exists($input, 'status') ? $input->status : null), $input->name, $input->description, $input->image_size, $input->disk_size, $input->created, $input->created_from, $input->bound_to, $input->os_flavor, $input->os_version, $input->rapid_deploy, Protection::parse($input->protection), get_object_vars($input->labels));
279+
return new self($input->id, $input->type, property_exists($input, 'status') ? $input->status : null, $input->name, $input->description, $input->image_size, $input->disk_size, $input->created, $input->created_from, $input->bound_to, $input->os_flavor, $input->os_version, $input->rapid_deploy, Protection::parse($input->protection), get_object_vars($input->labels));
280280
}
281281

282282
public function reload()

src/Models/Protection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ public static function parse($input)
4545
return;
4646
}
4747

48-
return new self($input->delete, (property_exists($input, 'rebuild') ? $input->rebuild : null));
48+
return new self($input->delete, property_exists($input, 'rebuild') ? $input->rebuild : null);
4949
}
5050
}

src/Traits/GetFunctionTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ protected function _all(RequestOpts $requestOpts)
2727
$requestOpts->page = $i;
2828
$_f = $this->list($requestOpts);
2929
$entities = array_merge($entities, $_f->{$this->_getKeys()['many']});
30-
if ($_f->meta->pagination->page === $_f->meta->pagination->last_page) {
30+
if ($_f->meta->pagination->page === $_f->meta->pagination->last_page || $_f->meta->pagination->last_page === null) {
3131
$max_pages = 0;
3232
}
3333
}

tests/Unit/RequestOptsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function buildQueryTestProvider()
3333

3434
/**
3535
* @dataProvider buildQueryTestProvider
36+
*
3637
* @test
3738
*/
3839
public function buildQuery($perPage, $page, $labelSelector, $expectedResult)

0 commit comments

Comments
 (0)