Completed
Push — master ( 6a0101...61ff1f )
by Karel
10:05 queued 08:15
created

HybridPartialResults::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
/*
4
 * This file is part of the FOSElasticaBundle package.
5
 *
6
 * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace FOS\ElasticaBundle\Paginator;
13
14
use Elastica\ResultSet;
15
use FOS\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface;
16
17
/**
18
 * Partial transformed result set.
19
 */
20
class HybridPartialResults extends RawPartialResults
21
{
22
    /**
23
     * @var ElasticaToModelTransformerInterface
24
     */
25
    protected $transformer;
26
27
    /**
28
     * @param ResultSet                           $resultSet
29
     * @param ElasticaToModelTransformerInterface $transformer
30
     */
31 2
    public function __construct(ResultSet $resultSet, ElasticaToModelTransformerInterface $transformer)
32
    {
33 2
        parent::__construct($resultSet);
34
35 2
        $this->transformer = $transformer;
36 2
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41 1
    public function toArray()
42
    {
43 1
        return $this->transformer->hybridTransform($this->resultSet->getResults());
44
    }
45
}
46