Completed
Pull Request — master (#1111)
by Karel
11:07 queued 07:06
created

HybridPartialResults   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 26
wmc 2
lcom 1
cbo 3
ccs 0
cts 9
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A toArray() 0 4 1
1
<?php
2
3
namespace FOS\ElasticaBundle\Paginator;
4
5
use FOS\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface;
6
use Elastica\ResultSet;
7
8
/**
9
 * Partial transformed result set
10
 */
11
class HybridPartialResults extends RawPartialResults
12
{
13
    /**
14
     * @var ElasticaToModelTransformerInterface
15
     */
16
    protected $transformer;
17
18
    /**
19
     * @param ResultSet                           $resultSet
20
     * @param ElasticaToModelTransformerInterface $transformer
21
     */
22
    public function __construct(ResultSet $resultSet, ElasticaToModelTransformerInterface $transformer)
23
    {
24
        parent::__construct($resultSet);
25
26
        $this->transformer = $transformer;
27
    }
28
29
    /**
30
     * {@inheritDoc}
31
     */
32
    public function toArray()
33
    {
34
        return $this->transformer->hybridTransform($this->resultSet->getResults());
35
    }
36
}
37