@@ -4,43 +4,43 @@ |
||
| 4 | 4 | |
| 5 | 5 | class ArrayDataProvider implements DataProviderInterface |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * @var array |
|
| 9 | - */ |
|
| 10 | - private $data; |
|
| 7 | + /** |
|
| 8 | + * @var array |
|
| 9 | + */ |
|
| 10 | + private $data; |
|
| 11 | 11 | |
| 12 | - public function __construct(array $data) |
|
| 13 | - { |
|
| 14 | - $this->data = $data; |
|
| 15 | - } |
|
| 12 | + public function __construct(array $data) |
|
| 13 | + { |
|
| 14 | + $this->data = $data; |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Should return total amount of rows |
|
| 19 | - * @return int |
|
| 20 | - */ |
|
| 21 | - public function getCount() : int |
|
| 22 | - { |
|
| 23 | - return count($this->data); |
|
| 24 | - } |
|
| 17 | + /** |
|
| 18 | + * Should return total amount of rows |
|
| 19 | + * @return int |
|
| 20 | + */ |
|
| 21 | + public function getCount() : int |
|
| 22 | + { |
|
| 23 | + return count($this->data); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Should return amount of pages |
|
| 28 | - * @param int $perPage - amount of records per page |
|
| 29 | - * @return int |
|
| 30 | - */ |
|
| 31 | - public function getTotalPages(int $perPage) : int |
|
| 32 | - { |
|
| 33 | - return ceil($this->getCount() / $perPage); |
|
| 34 | - } |
|
| 26 | + /** |
|
| 27 | + * Should return amount of pages |
|
| 28 | + * @param int $perPage - amount of records per page |
|
| 29 | + * @return int |
|
| 30 | + */ |
|
| 31 | + public function getTotalPages(int $perPage) : int |
|
| 32 | + { |
|
| 33 | + return ceil($this->getCount() / $perPage); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Should return a list of data for current page |
|
| 38 | - * @param int $page |
|
| 39 | - * @param int $perPage - amount of records per page |
|
| 40 | - * @return mixed |
|
| 41 | - */ |
|
| 42 | - public function getData(int $page, int $perPage) |
|
| 43 | - { |
|
| 44 | - return array_splice($this->data, ($page -1) * $perPage, $perPage); |
|
| 45 | - } |
|
| 36 | + /** |
|
| 37 | + * Should return a list of data for current page |
|
| 38 | + * @param int $page |
|
| 39 | + * @param int $perPage - amount of records per page |
|
| 40 | + * @return mixed |
|
| 41 | + */ |
|
| 42 | + public function getData(int $page, int $perPage) |
|
| 43 | + { |
|
| 44 | + return array_splice($this->data, ($page -1) * $perPage, $perPage); |
|
| 45 | + } |
|
| 46 | 46 | } |
| 47 | 47 | \ No newline at end of file |
@@ -41,6 +41,6 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | public function getData(int $page, int $perPage) |
| 43 | 43 | { |
| 44 | - return array_splice($this->data, ($page -1) * $perPage, $perPage); |
|
| 44 | + return array_splice($this->data, ($page - 1) * $perPage, $perPage); |
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | \ No newline at end of file |