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

Repository   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 84.62%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 69
wmc 6
lcom 1
cbo 1
ccs 11
cts 13
cp 0.8462
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A find() 0 4 1
A findHybrid() 0 4 1
A findPaginated() 0 4 1
A createPaginatorAdapter() 0 4 1
A createHybridPaginatorAdapter() 0 4 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
    /** @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