Failed Conditions
Pull Request — task/3376-TYPO3_12_compatibili... (#3569)
by
unknown
46:02 queued 01:00
created

AbstractSolrFrontendViewHelper::getControllerContext()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 12
rs 10
c 0
b 0
f 0
cc 3
nc 4
nop 0
1
<?php
2
3
declare(strict_types=1);
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
namespace ApacheSolrForTypo3\Solr\ViewHelpers;
19
20
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Grouping\GroupItem;
21
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\SearchResultSet;
22
use ApacheSolrForTypo3\Solr\System\Configuration\TypoScriptConfiguration;
23
use InvalidArgumentException;
24
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
25
26
/**
27
 * Class AbstractSolrFrontendViewHelper
28
 *
29
 * @author Frans Saris <[email protected]>
30
 * @author Timo Hund <[email protected]>
31
 */
32
abstract class AbstractSolrFrontendViewHelper extends AbstractSolrViewHelper
33
{
34
    /**
35
     * @return TypoScriptConfiguration|null
36
     */
37
    protected function getTypoScriptConfiguration(): ?TypoScriptConfiguration
38
    {
39
        return $this->renderingContext->getVariableProvider()->get('typoScriptConfiguration');
40
    }
41
42
    /**
43
     * @return SearchResultSet|null
44
     */
45
    protected function getSearchResultSet(): ?SearchResultSet
46
    {
47
        return $this->renderingContext->getVariableProvider()->get('searchResultSet');
48
    }
49
50
    /**
51
     * @param RenderingContextInterface $renderingContext
52
     * @return SearchResultSet|GroupItem|null
53
     */
54
    protected static function getUsedSearchResultSetFromRenderingContext(
55
        RenderingContextInterface $renderingContext
56
    ) {
57
        return $renderingContext->getVariableProvider()->get('resultSet')
58
            ?? $renderingContext->getControllerContext()->getSearchResultSet();
0 ignored issues
show
Bug introduced by
The method getControllerContext() does not exist on TYPO3Fluid\Fluid\Core\Re...nderingContextInterface. Did you maybe mean getControllerAction()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

58
            ?? $renderingContext->/** @scrutinizer ignore-call */ getControllerContext()->getSearchResultSet();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
59
    }
60
}
61