Code Duplication    Length = 24-25 lines in 2 locations

Paginator/HybridPaginatorAdapter.php 1 location

@@ 12-35 (lines=24) @@
9
/**
10
 * Allows pagination of \Elastica\Query
11
 */
12
class HybridPaginatorAdapter extends RawPaginatorAdapter
13
{
14
    private $transformer;
15
16
    /**
17
     * @param SearchableInterface $searchable the object to search in
18
     * @param Query $query the query to search
19
     * @param ElasticaToModelTransformerInterface $transformer the transformer for fetching the results
20
     */
21
    public function __construct(SearchableInterface $searchable, Query $query, ElasticaToModelTransformerInterface $transformer)
22
    {
23
        parent::__construct($searchable, $query);
24
25
        $this->transformer = $transformer;
26
    }
27
28
    /**
29
     * {@inheritDoc}
30
     */
31
    public function getResults($offset, $length)
32
    {
33
        return new HybridPartialResults($this->getElasticaResults($offset, $length), $this->transformer);
34
    }
35
}
36

Paginator/TransformedPaginatorAdapter.php 1 location

@@ 12-36 (lines=25) @@
9
/**
10
 * Allows pagination of \Elastica\Query.
11
 */
12
class TransformedPaginatorAdapter extends RawPaginatorAdapter
13
{
14
    private $transformer;
15
16
    /**
17
     * @param SearchableInterface                 $searchable  the object to search in
18
     * @param Query                               $query       the query to search
19
     * @param array                               $options
20
     * @param ElasticaToModelTransformerInterface $transformer the transformer for fetching the results
21
     */
22
    public function __construct(SearchableInterface $searchable, Query $query, array $options = array(), ElasticaToModelTransformerInterface $transformer)
23
    {
24
        parent::__construct($searchable, $query, $options);
25
26
        $this->transformer = $transformer;
27
    }
28
29
    /**
30
     * {@inheritDoc}
31
     */
32
    public function getResults($offset, $length)
33
    {
34
        return new TransformedPartialResults($this->getElasticaResults($offset, $length), $this->transformer);
35
    }
36
}
37