Passed
Pull Request — master (#1317)
by
unknown
21:24
created

ResultPageViewHelper::renderStatic()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1.0233

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 5
cts 7
cp 0.7143
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 3
crap 1.0233
1
<?php
2
namespace ApacheSolrForTypo3\Solr\ViewHelpers\Frontend\Uri\Paginate;
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 ResultPageViewHelper extends AbstractUriViewHelper
28
{
29
30
    /**
31
     * Initializes the arguments
32
     */
33 2
    public function initializeArguments()
34
    {
35 2
        parent::initializeArguments();
36 2
        $this->registerArgument('page', 'int', 'The page', false, 0);
37
38 2
    }
39
40
    /**
41
     * @param array $arguments
42
     * @param \Closure $renderChildrenClosure
43
     * @param RenderingContextInterface $renderingContext
44
     * @return string
45
     */
46 8
    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
47
    {
48 8
        $page = $arguments['page'];
49 8
        $previousRequest = static::getUsedSearchRequestFromRenderingContext($renderingContext);
50 8
        $uri = self::getSearchUriBuilder()->getResultPageUri($previousRequest, $page);
51 8
        return $uri;
52
    }
53
}
54