<commit_before><?php

namespace Elodex\Pagination;

use Illuminate\Pagination\LengthAwarePaginator as BasePaginator;

class LengthAwarePaginator extends BasePaginator
{
    /**
     * The search result instance for this paginator.
     *
     * @var \Elodex\SearchResult
     */
    protected $searchResult;

    /**
     * Create a new paginator instance.
     *
     * @param  \Elodex\SearchResult $searchResult
     * @param  int $perPage
     * @param  int|null $currentPage
     * @param  array $options (path, query, fragment, pageName)
     */
    public function __construct($searchResult, $perPage, $currentPage = null, array $options = [])
    {
        $this->searchResult = $searchResult;

        $total = $this->searchResult->totalHits();
        $items = $this->searchResult->getDocuments();

        parent::__construct($items, $total, $perPage, $currentPage, $options);
    }

    /**
     * {@inheritdoc}
     */
    public function toArray()
    {
        $data = parent::toArray();

        $data['search_result'] = $this->searchResult->toArray();

        return $data;
    }

    /**
     * Get the collection of models for the search result.
     *
     * @param  array|null $with
     * @return \Illuminate\Database\Eloquent\Collection|array
     */
    public function getItems(array $with = null)
    {
        return $this->searchResults->getModels($with);
    }

    /**
     * Get the search result instance for this paginator.
     *
     * @return \Elodex\SearchResult
     */
    public function getSearchResult()
    {
        return $this->searchResult;
    }
}<commit_msg>Made the method to get the models on a paginator consistent with the one of the search result class<commit_after><?php

namespace Elodex\Pagination;

use Illuminate\Pagination\LengthAwarePaginator as BasePaginator;

class LengthAwarePaginator extends BasePaginator
{
    /**
     * The search result instance for this paginator.
     *
     * @var \Elodex\SearchResult
     */
    protected $searchResult;

    /**
     * Create a new paginator instance.
     *
     * @param  \Elodex\SearchResult $searchResult
     * @param  int $perPage
     * @param  int|null $currentPage
     * @param  array $options (path, query, fragment, pageName)
     */
    public function __construct($searchResult, $perPage, $currentPage = null, array $options = [])
    {
        $this->searchResult = $searchResult;

        $total = $this->searchResult->totalHits();
        $items = $this->searchResult->getDocuments();

        parent::__construct($items, $total, $perPage, $currentPage, $options);
    }

    /**
     * {@inheritdoc}
     */
    public function toArray()
    {
        $data = parent::toArray();

        $data['search_result'] = $this->searchResult->toArray();

        return $data;
    }

    /**
     * Get the collection of models for the search result.
     *
     * @param  array|null $with
     * @return \Illuminate\Database\Eloquent\Collection|array
     */
    public function getModels(array $with = null)
    {
        return $this->searchResults->getModels($with);
    }

    /**
     * Get the search result instance for this paginator.
     *
     * @return \Elodex\SearchResult
     */
    public function getSearchResult()
    {
        return $this->searchResult;
    }
}
{'fraction_non_alphanumeric': 0.12056952438654953, 'fraction_numerical': 0.0, 'mean_word_length': 2.516506922257721, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6632588', 'n_tokens_mistral': 973, 'n_tokens_neox': 974, 'n_words': 234}