Failed Conditions
Pull Request — master (#3000)
by
unknown
37:55
created

SetFacetItemViewHelper::renderStatic()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 9
ccs 7
cts 7
cp 1
rs 10
cc 1
nc 1
nop 3
crap 1
1
<?php
2
namespace ApacheSolrForTypo3\Solr\ViewHelpers\Uri\Facet;
3
4
/*
5
 * This file is part of the TYPO3 CMS project.
6
 *
7
 * It is free software; you can redistribute it and/or modify it under
8
 * the terms of the GNU General Public License, either version 2
9
 * of the License, or any later version.
10
 *
11
 * For the full copyright and license information, please read the
12
 * LICENSE.txt file that was distributed with this source code.
13
 *
14
 * The TYPO3 project - inspiring people to share!
15
 */
16
17
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\SearchResultSet;
18
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
19
20
/**
21
 * Class SetFacetItemViewHelper
22
 *
23
 * @author Frans Saris <[email protected]>
24
 * @author Timo Hund <[email protected]>
25
 */
26
class SetFacetItemViewHelper extends AbstractValueViewHelper
27
{
28
29
    /**
30
     * @param array $arguments
31
     * @param \Closure $renderChildrenClosure
32
     * @param RenderingContextInterface $renderingContext
33
     * @return string
34
     * @throws \InvalidArgumentException
35
     */
36 2
    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
37
    {
38
        /** @var  $resultSet SearchResultSet */
39 2
        $name = self::getNameFromArguments($arguments);
40 2
        $itemValue = self::getValueFromArguments($arguments);
41 2
        $resultSet = self::getResultSetFromArguments($arguments);
42 2
        $previousRequest = $resultSet->getUsedSearchRequest();
43 2
        $uri = self::getSearchUriBuilder($renderingContext)->getSetFacetValueUri($previousRequest, $name, $itemValue);
44 2
        return $uri;
45
    }
46
}
47