SkipHiddenSettingsFilter   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A modifySearch() 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\Filter;
13
14
use ONGR\ElasticsearchDSL\Query\Compound\BoolQuery;
15
use ONGR\ElasticsearchDSL\Query\TermLevel\TermQuery;
16
use ONGR\ElasticsearchDSL\Search;
17
use ONGR\FilterManagerBundle\Filter\FilterState;
18
use ONGR\FilterManagerBundle\Filter\Widget\Search\AbstractSingleValue;
19
use ONGR\FilterManagerBundle\Search\SearchRequest;
20
21
/**
22
 * This class runs match search.
23
 */
24
class SkipHiddenSettingsFilter extends AbstractSingleValue
25
{
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function modifySearch(Search $search, FilterState $state = null, SearchRequest $request = null)
30
    {
31
        $hidden = new TermQuery('type', 'hidden');
32
        $experiment = new TermQuery('type', 'experiment');
33
        $search->addQuery($hidden, BoolQuery::MUST_NOT);
34
        $search->addQuery($experiment, BoolQuery::MUST_NOT);
35
    }
36
}
37