Completed
Push — master ( a95893...a4d2df )
by Timo
13:46 queued 13:38
created

StartNewSearchViewHelper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 26
ccs 9
cts 12
cp 0.75
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A initializeArguments() 0 5 1
A renderStatic() 0 7 1
1
<?php
2
namespace ApacheSolrForTypo3\Solr\ViewHelpers\Frontend\Uri\Search;
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\ViewHelpers\Frontend\Uri\AbstractUriViewHelper;
18
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
19
20
/**
21
 * Class FacetAddOptionViewHelper
22
 *
23
 * @author Frans Saris <[email protected]>
24
 * @author Timo Hund <[email protected]>
25
 * @package ApacheSolrForTypo3\Solr\ViewHelpers\Link
26
 */
27
class StartNewSearchViewHelper extends AbstractUriViewHelper
28
{
29
30
    /**
31
     * Initializes the arguments
32
     */
33 23
    public function initializeArguments()
34
    {
35 23
        parent::initializeArguments();
36 23
        $this->registerArgument('queryString', 'string', 'The query string', false, '');
37 23
    }
38
39
    /**
40
     * @param array $arguments
41
     * @param \Closure $renderChildrenClosure
42
     * @param RenderingContextInterface $renderingContext
43
     * @return string
44
     */
45 21
    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
46
    {
47 21
        $queryString = $arguments['queryString'];
48 21
        $previousRequest = static::getUsedSearchRequestFromRenderingContext($renderingContext);
49 21
        $uri = self::getSearchUriBuilder()->getNewSearchUri($previousRequest, $queryString);
50 21
        return $uri;
51
    }
52
}
53