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

SolrVariableProvider::getScopeCopy()   B

Complexity

Conditions 7
Paths 8

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 15
rs 8.8333
cc 7
nc 8
nop 1
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\Mvc\Variable;
19
20
use TYPO3Fluid\Fluid\Core\Variables\StandardVariableProvider;
21
use TYPO3Fluid\Fluid\Core\Variables\VariableProviderInterface;
22
23
/**
24
 * Extended version of the StandardVariableProvider
25
 * We added searchResultsSet and TypoScriptConfiguration to variables which would be
26
 * transferred to each render/section/layout
27
 */
28
class SolrVariableProvider extends StandardVariableProvider
29
{
30
    /**
31
     * @param array|\ArrayAccess $variables
32
     */
33
    public function getScopeCopy($variables): VariableProviderInterface
34
    {
35
        if (!array_key_exists('settings', $variables) && array_key_exists('settings', $this->variables)) {
36
            $variables['settings'] = $this->variables['settings'];
37
        }
38
        if (!array_key_exists('searchResultSet', $variables) && array_key_exists('searchResultSet', $this->variables)) {
39
            $variables['searchResultSet'] = $this->variables['searchResultSet'];
40
        }
41
        if (!array_key_exists('typoScriptConfiguration', $variables) && array_key_exists('typoScriptConfiguration', $this->variables)) {
42
            $variables['typoScriptConfiguration'] = $this->variables['typoScriptConfiguration'];
43
        }
44
45
        $className = get_class($this);
46
47
        return new $className($variables);
48
    }
49
}
50