Repository   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 60
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

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
/*
4
 * This file is part of the FOSElasticaBundle package.
5
 *
6
 * (c) FriendsOfSymfony <https://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;
13
14
use FOS\ElasticaBundle\Finder\PaginatedFinderInterface;
15
16
/**
17
 * @author Richard Miller <[email protected]>
18
 *
19
 * Basic repository to be extended to hold custom queries to be run
20
 * in the finder
21
 */
22
class Repository
23
{
24
    /** @var PaginatedFinderInterface */
25
    protected $finder;
26
27 11
    public function __construct(PaginatedFinderInterface $finder)
28
    {
29 11
        $this->finder = $finder;
30 11
    }
31
32
    /**
33
     * @param mixed $query
34
     *
35
     * @return array
36
     */
37 2
    public function find($query, ?int $limit = null, array $options = [])
38
    {
39 2
        return $this->finder->find($query, $limit, $options);
40
    }
41
42
    /**
43
     * @param mixed $query
44
     *
45
     * @return mixed
46
     */
47 1
    public function findHybrid($query, ?int $limit = null, array $options = [])
48
    {
49 1
        return $this->finder->findHybrid($query, $limit, $options);
50
    }
51
52
    /**
53
     * @param mixed $query
54
     *
55
     * @return \Pagerfanta\Pagerfanta
56
     */
57 1
    public function findPaginated($query, array $options = [])
58
    {
59 1
        return $this->finder->findPaginated($query, $options);
60
    }
61
62
    /**
63
     * @param mixed $query
64
     *
65
     * @return Paginator\PaginatorAdapterInterface
66
     */
67 1
    public function createPaginatorAdapter($query, array $options = [])
68
    {
69 1
        return $this->finder->createPaginatorAdapter($query, $options);
70
    }
71
72
    /**
73
     * @param mixed $query
74
     *
75
     * @return Paginator\HybridPaginatorAdapter
76
     */
77 1
    public function createHybridPaginatorAdapter($query, array $options = [])
78
    {
79 1
        return $this->finder->createHybridPaginatorAdapter($query, $options);
80
    }
81
}
82