Completed
Pull Request — master (#1052)
by
unknown
07:01
created

Repository::createPaginatorAdapter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 1
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
    protected $finder;
16
17 11
    public function __construct(PaginatedFinderInterface $finder)
18
    {
19 11
        $this->finder = $finder;
20 11
    }
21
22
    /**
23
     * @param mixed   $query
24
     * @param integer $limit
25
     * @param array   $options
26
     *
27
     * @return array
28
     */
29 2
    public function find($query, $limit = null, $options = array())
30
    {
31 2
        return $this->finder->find($query, $limit, $options);
32
    }
33
34
    /**
35
     * @param mixed   $query
36
     * @param integer $limit
37
     * @param array   $options
38
     *
39
     * @return mixed
40
     */
41 1
    public function findHybrid($query, $limit = null, $options = array())
42
    {
43 1
        return $this->finder->findHybrid($query, $limit, $options);
44
    }
45
46
    /**
47
     * @param mixed   $query
48
     * @param integer $limit
49
     * @param array   $options
50
     *
51
     * @return mixed
52
     */
53 1
    public function findRawResult($query, $limit = null, $options = array())
54
    {
55 1
        return $this->finder->findRawResult($query, $limit, $options);
56
    }
57
58
    /**
59
     * @param mixed $query
60
     * @param array $options
61
     *
62
     * @return \Pagerfanta\Pagerfanta
63
     */
64 1
    public function findPaginated($query, $options = array())
65
    {
66 1
        return $this->finder->findPaginated($query, $options);
67
    }
68
69
    /**
70
     * @param string $query
71
     * @param array  $options
72
     *
73
     * @return Paginator\PaginatorAdapterInterface
74
     */
75 1
    public function createPaginatorAdapter($query, $options = array())
76
    {
77 1
        return $this->finder->createPaginatorAdapter($query, $options);
78
    }
79
80
    /**
81
     * @param mixed $query
82
     * @param array $options
83
     *
84
     * @return \Pagerfanta\Pagerfanta
85
     */
86 1
    public function findRawPaginated($query, $options = array())
87
    {
88 1
        return $this->finder->findRawPaginated($query, $options);
89
    }
90
91
    /**
92
     * @param string $query
93
     * @param array  $options
94
     *
95
     * @return Paginator\PaginatorAdapterInterface
96
     */
97 1
    public function createRawPaginatorAdapter($query, $options = array())
98
    {
99 1
        return $this->finder->createRawPaginatorAdapter($query, $options);
100
    }
101
}
102