public function handle($mixed): Pagination
    {
        if ($mixed instanceof Collection) {
            $this->mixed = $mixed;
            $this->nb_pages = ceil(max(count($mixed), 1) / max($this->nb_per_page, 1));
        } else {
            if ($mixed instanceof \Countable) {
                $this->mixed = $mixed;
                $this->nb_pages = ceil(max(count($mixed), 1) / max($this->nb_per_page, 1));
            } else {
                if (is_int($mixed)) {
                    $this->mixed = $mixed;
                    $this->nb_pages = ceil(max($mixed, 1) / max($this->nb_per_page, 1));
                } else {
                    trigger_error('Parameter of Pagination::handle must be an Collection object or integer', E_USER_WARNING);
                }
            }
        }

        return $this;
    }
public function handle($mixed): Pagination
    {
        if ($mixed instanceof Collection) {
            $this->mixed = $mixed;
            $this->nb_pages = ceil(max(count($mixed), 1) / max($this->nb_per_page, 1));
        } else {
            if ($mixed instanceof \Countable) {
                $this->mixed = $mixed;
                $this->nb_pages = ceil(max(count($mixed), 1) / max($this->nb_per_page, 1));
            } else {
                if (is_int($mixed)) {
                    $this->mixed = $mixed;
                    $this->nb_pages = ceil(max($mixed, 1) / max($this->nb_per_page, 1));
                } else {
                    trigger_error('Parameter of Pagination::handle must be an Collection object or integer', E_USER_WARNING);
                }
            }
        }

        return $this;
    }
public function handle ( $ mixed ) : Pagination { if ( $ mixed instanceof Collection ) { $ this -> mixed = $ mixed ; $ this -> nb_pages = ceil ( max ( count ( $ mixed ) , 1 ) / max ( $ this -> nb_per_page , 1 ) ) ; } else { if ( $ mixed instanceof \ Countable ) { $ this -> mixed = $ mixed ; $ this -> nb_pages = ceil ( max ( count ( $ mixed ) , 1 ) / max ( $ this -> nb_per_page , 1 ) ) ; } else { if ( is_int ( $ mixed ) ) { $ this -> mixed = $ mixed ; $ this -> nb_pages = ceil ( max ( $ mixed , 1 ) / max ( $ this -> nb_per_page , 1 ) ) ; } else { trigger_error ( 'Parameter of Pagination::handle must be an Collection object or integer' , E_USER_WARNING ) ; } } } return $ this ; }
Called to complete the Pagination object with the number of elements.

Need to call this method after to get elements with Collection.
If no Collection method used, need to pass an integer with value of number
of elements.

@param \Berlioz\Core\Entity\Collection|\Countable|int $mixed  Collection with nbTotal property completed or
integer

@return static
Called to complete the Pagination object with the number of elements .