Passed
Push — task/2976_TYPO3.11_compatibili... ( d7dfd0...4be1cc )
by Rafael
03:40
created

ResultPageViewHelper::initializeArguments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace ApacheSolrForTypo3\Solr\ViewHelpers\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\Uri\AbstractUriViewHelper;
18
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
19
20
/**
21
 * Class ResultPageViewHelper
22
 *
23
 * @author Frans Saris <[email protected]>
24
 * @author Timo Hund <[email protected]>
25
 */
26
class ResultPageViewHelper extends AbstractUriViewHelper
27
{
28
29
    /**
30
     * Initializes the arguments
31
     */
32 25
    public function initializeArguments()
33
    {
34 25
        parent::initializeArguments();
35 25
        $this->registerArgument('page', 'int', 'The page', false, 0);
36
37 25
    }
38
39
    /**
40
     * @param array $arguments
41
     * @param \Closure $renderChildrenClosure
42
     * @param RenderingContextInterface $renderingContext
43
     * @return string
44
     */
45 25
    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
46
    {
47 25
        $page = $arguments['page'];
48 25
        $previousRequest = static::getUsedSearchRequestFromRenderingContext($renderingContext);
49 25
        $uri = self::getSearchUriBuilder($renderingContext)->getResultPageUri($previousRequest, $page);
50 25
        return $uri;
51
    }
52
}
53