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

Repository::createHybridPaginatorAdapter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
namespace FOS\ElasticaBundle;
4
5
use FOS\ElasticaBundle\Finder\PaginatedFinderInterface;
6
7
/**
8
 * @author Richard Miller <[email protected]>
9
 *
10
 * Basic repository to be extended to hold custom queries to be run
11
 * in the finder.
12
 */
13
class Repository
14
{
15
    /** @var PaginatedFinderInterface */
16
    protected $finder;
17
18
    /**
19
     * @param PaginatedFinderInterface $finder
20
     */
21 8
    public function __construct(PaginatedFinderInterface $finder)
22
    {
23 8
        $this->finder = $finder;
24 8
    }
25
26
    /**
27
     * @param mixed   $query
28
     * @param integer $limit
29
     * @param array   $options
30
     *
31
     * @return array
32
     */
33 2
    public function find($query, $limit = null, $options = array())
34
    {
35 2
        return $this->finder->find($query, $limit, $options);
36
    }
37
38
    /**
39
     * @param mixed   $query
40
     * @param integer $limit
41
     * @param array   $options
42
     *
43
     * @return mixed
44
     */
45 1
    public function findHybrid($query, $limit = null, $options = array())
46
    {
47 1
        return $this->finder->findHybrid($query, $limit, $options);
48
    }
49
50
    /**
51
     * @param mixed $query
52
     * @param array $options
53
     *
54
     * @return \Pagerfanta\Pagerfanta
55
     */
56 1
    public function findPaginated($query, $options = array())
57
    {
58 1
        return $this->finder->findPaginated($query, $options);
59
    }
60
61
    /**
62
     * @param string $query
63
     * @param array  $options
64
     *
65
     * @return Paginator\PaginatorAdapterInterface
66
     */
67 1
    public function createPaginatorAdapter($query, $options = array())
68
    {
69 1
        return $this->finder->createPaginatorAdapter($query, $options);
70
    }
71
72
    /**
73
     * @param mixed $query
74
     *
75
     * @return Paginator\HybridPaginatorAdapter
76
     */
77
    public function createHybridPaginatorAdapter($query)
78
    {
79
        return $this->finder->createHybridPaginatorAdapter($query);
80
    }
81
}
82