Completed
Pull Request — master (#167)
by
unknown
17:54
created

ProfileManager   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 1
cbo 3
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A findAllProfiles() 0 7 1
1
<?php
2
3
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[email protected]>
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 ONGR\SettingsBundle\Service;
13
14
use ONGR\ElasticsearchBundle\Service\Manager;
15
use ONGR\ElasticsearchDSL\Query\MatchAllQuery;
16
17
class ProfileManager
18
{
19
    /**
20
     * @var Manager
21
     */
22
    private $manager;
23
24
    /**
25
     * ProfileFinder constructor.
26
     * @param Manager $manager
27
     */
28
    public function __construct(Manager $manager)
29
    {
30
        $this->manager = $manager;
31
    }
32
33
    /**
34
     * Finds all profiles
35
     */
36
    public function findAllProfiles()
37
    {
38
        $repo = $this->manager->getRepository('ONGRSettingsBundle:Profile');
39
        $search = $repo->createSearch();
40
        $search->addQuery(new MatchAllQuery());
41
        return $repo->execute($search, 'array');
42
    }
43
}