<?php namespace Eae\Support;


/**
* Transforms values based on array on transformation rules
*/

class Paginator
{
    private $items = null;
    private $currentPage;
    private $totalItems;
    private $perPage;
    
    public function __construct($items, $totalItems, $perPage, $currentPage = 1){
        $this->items = $items;
        $this->perPage = (int)$perPage;
        $this->totalItems = (int)$totalItems;
        $this->currentPage = (int)$currentPage;
    }

    public function getCurrentPage(){
        return $this->currentPage;
    }
    
    public function getPerPage(){
        return $this->perPage;
    }
    
    public function getLastPage(){
        return (int)ceil($this->totalItems / $this->perPage);
    }
    
    public function getTotal(){
        return $this->totalItems;
    }
    
    public function count(){
        return $this->items->count();
    }
    
    public function getCollection(){
        return $this->items;
    }

    public function getTotalPages() {
        return (int)ceil($this->totalItems / $this->perPage);
    }
    
}
