Passed
Push — master ( ebcd1a...0e387b )
by Timo
04:23
created

QueryGroupFacetQueryBuilder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 19
ccs 6
cts 8
cp 0.75
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 0 11 2
1
<?php
2
namespace ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets\OptionBased\QueryGroup;
3
/*
4
 * This file is part of the TYPO3 CMS project.
5
 *
6
 * It is free software; you can redistribute it and/or modify it under
7
 * the terms of the GNU General Public License, either version 2
8
 * of the License, or any later version.
9
 *
10
 * For the full copyright and license information, please read the
11
 * LICENSE.txt file that was distributed with this source code.
12
 *
13
 * The TYPO3 project - inspiring people to share!
14
*/
15
16
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets\DefaultFacetQueryBuilder;
17
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets\FacetQueryBuilderInterface;
18
use ApacheSolrForTypo3\Solr\System\Configuration\TypoScriptConfiguration;
19
20
class QueryGroupFacetQueryBuilder extends DefaultFacetQueryBuilder implements FacetQueryBuilderInterface {
21
22
    /**
23
     * @param string $facetName
24
     * @param TypoScriptConfiguration $configuration
25
     * @return array
26 28
     */
27
    public function build($facetName, TypoScriptConfiguration $configuration)
28 28
    {
29 28
        $facetParameters = [];
30
        $facetConfiguration = $configuration->getSearchFacetingFacetByName($facetName);
31 28
        foreach ($facetConfiguration['queryGroup.'] as $queryName => $queryConfiguration) {
32 28
            $tags = $this->buildExcludeTags($facetConfiguration, $configuration);
33 28
            $facetParameters['facet.query'][] = $tags . $facetConfiguration['field'] . ':' . $queryConfiguration['query'];
34
        }
35
36
        return $facetParameters;
37
    }
38
}
39