Passed
Pull Request — master (#1348)
by Timo
32:03
created

AbstractSolrFrontendViewHelper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 33
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getTypoScriptConfiguration() 0 4 1
A getSearchResultSet() 0 4 1
A getUsedSearchResultSetFromRenderingContext() 0 5 1
1
<?php
2
namespace ApacheSolrForTypo3\Solr\ViewHelpers;
3
4
5
/*
6
 * This file is part of the TYPO3 CMS project.
7
 *
8
 * It is free software; you can redistribute it and/or modify it under
9
 * the terms of the GNU General Public License, either version 2
10
 * of the License, or any later version.
11
 *
12
 * For the full copyright and license information, please read the
13
 * LICENSE.txt file that was distributed with this source code.
14
 *
15
 * The TYPO3 project - inspiring people to share!
16
 */
17
18
use ApacheSolrForTypo3\Solr\System\Configuration\TypoScriptConfiguration;
19
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\SearchResultSet;
20
use ApacheSolrForTypo3\Solr\Mvc\Controller\SolrControllerContext;
21
use ApacheSolrForTypo3\Solr\ViewHelpers\AbstractSolrViewHelper;
22
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
23
24
/**
25
 * Class AbstractViewHelper
26
 *
27
 * @author Frans Saris <[email protected]>
28
 * @author Timo Hund <[email protected]>
29
 * @package ApacheSolrForTypo3\Solr\ViewHelpers
30
 */
31
abstract class AbstractSolrFrontendViewHelper extends AbstractSolrViewHelper
32
{
33
    /**
34
     * @var SolrControllerContext
35
     */
36
    protected $controllerContext;
37
38
    /**
39
     * @return TypoScriptConfiguration
40
     */
41
    protected function getTypoScriptConfiguration()
42
    {
43
        return $this->controllerContext->getTypoScriptConfiguration();
44
    }
45
46
    /**
47
     * @return SearchResultSet
48
     */
49
    protected function getSearchResultSet()
50
    {
51
        return $this->controllerContext->getSearchResultSet();
52
    }
53
54
    /**
55
     * @param RenderingContextInterface $renderingContext
56
     * @return SearchResultSet
57
     */
58
    protected static function getUsedSearchResultSetFromRenderingContext(RenderingContextInterface $renderingContext)
59
    {
60
        $resultSet = $renderingContext->getVariableProvider()->get('resultSet');
61
        return $resultSet;
62
    }
63
}
64