Code Coverage  | 
      ||||||||||
Lines  | 
       Functions and Methods  | 
       Classes and Traits  | 
      ||||||||
| Total |         | 
       90.91%  | 
       10 / 11  | 
               | 
       90.91%  | 
       10 / 11  | 
       CRAP |         | 
       0.00%  | 
       0 / 1  | 
      
| ListOptions |         | 
       90.91%  | 
       10 / 11  | 
               | 
       90.91%  | 
       10 / 11  | 
       11.09 |         | 
       0.00%  | 
       0 / 1  | 
      
| __construct |         | 
       100.00%  | 
       1 / 1  | 
               | 
       100.00%  | 
       1 / 1  | 
       1 | |||
| getPerPage |         | 
       100.00%  | 
       1 / 1  | 
               | 
       100.00%  | 
       1 / 1  | 
       1 | |||
| setPerPage |         | 
       100.00%  | 
       1 / 1  | 
               | 
       100.00%  | 
       1 / 1  | 
       1 | |||
| getTotal |         | 
       100.00%  | 
       1 / 1  | 
               | 
       100.00%  | 
       1 / 1  | 
       1 | |||
| setTotal |         | 
       100.00%  | 
       1 / 1  | 
               | 
       100.00%  | 
       1 / 1  | 
       1 | |||
| getNextCursor |         | 
       100.00%  | 
       1 / 1  | 
               | 
       100.00%  | 
       1 / 1  | 
       1 | |||
| setNextCursor |         | 
       100.00%  | 
       1 / 1  | 
               | 
       100.00%  | 
       1 / 1  | 
       1 | |||
| getPrevCursor |         | 
       100.00%  | 
       1 / 1  | 
               | 
       100.00%  | 
       1 / 1  | 
       1 | |||
| setPrevCursor |         | 
       100.00%  | 
       1 / 1  | 
               | 
       100.00%  | 
       1 / 1  | 
       1 | |||
| getCurrentCursor |         | 
       100.00%  | 
       1 / 1  | 
               | 
       100.00%  | 
       1 / 1  | 
       1 | |||
| setCurrentCursor |         | 
       0.00%  | 
       0 / 1  | 
               | 
       0.00%  | 
       0 / 1  | 
       2 | |||
| 1 | <?php | 
| 2 | |
| 3 | declare(strict_types=1); | 
| 4 | |
| 5 | namespace Vultr\VultrPhp\Util; | 
| 6 | |
| 7 | /** | 
| 8 | * Pagination and metadata mechanism that can be used throughout all list functions. | 
| 9 | * | 
| 10 | * @see https://www.vultr.com/api/#section/Introduction/Meta-and-Pagination | 
| 11 | */ | 
| 12 | class ListOptions | 
| 13 | { | 
| 14 | protected int $perPage = 50; | 
| 15 | protected int $total = 0; | 
| 16 | |
| 17 | protected string $nextCursor = ''; | 
| 18 | protected string $prevCursor = ''; | 
| 19 | protected string $currentCursor = ''; | 
| 20 | |
| 21 | public function __construct(int $perPage = 50) | 
| 22 | { | 
| 23 | $this->setPerPage($perPage); | 
| 24 | } | 
| 25 | |
| 26 | public function getPerPage() : int | 
| 27 | { | 
| 28 | return $this->perPage; | 
| 29 | } | 
| 30 | public function setPerPage(int $per_page) : void | 
| 31 | { | 
| 32 | $this->perPage = $per_page; | 
| 33 | } | 
| 34 | |
| 35 | public function getTotal() : int | 
| 36 | { | 
| 37 | return $this->total; | 
| 38 | } | 
| 39 | |
| 40 | public function setTotal(int $total) : void | 
| 41 | { | 
| 42 | $this->total = $total; | 
| 43 | } | 
| 44 | |
| 45 | public function getNextCursor() : string | 
| 46 | { | 
| 47 | return $this->nextCursor; | 
| 48 | } | 
| 49 | |
| 50 | public function setNextCursor(string $next_cursor) : void | 
| 51 | { | 
| 52 | $this->nextCursor = $next_cursor; | 
| 53 | } | 
| 54 | |
| 55 | public function getPrevCursor() : string | 
| 56 | { | 
| 57 | return $this->prevCursor; | 
| 58 | } | 
| 59 | |
| 60 | public function setPrevCursor(string $prev_cursor) : void | 
| 61 | { | 
| 62 | $this->prevCursor = $prev_cursor; | 
| 63 | } | 
| 64 | |
| 65 | public function getCurrentCursor() : string | 
| 66 | { | 
| 67 | return $this->currentCursor; | 
| 68 | } | 
| 69 | |
| 70 | public function setCurrentCursor(string $current_cursor) : void | 
| 71 | { | 
| 72 | $this->currentCursor = $current_cursor; | 
| 73 | } | 
| 74 | } |