Passed
Push — master ( 203e1d...831cab )
by Timo
27:25
created

LastSearchesController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 3
dl 0
loc 14
ccs 7
cts 8
cp 0.875
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A indexAction() 0 8 1
1
<?php
2
namespace ApacheSolrForTypo3\Solr\ViewHelpers\Widget\Controller;
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\Domain\Search\LastSearches\LastSearchesService;
18
use ApacheSolrForTypo3\Solr\Util;
19
use ApacheSolrForTypo3\Solr\Widget\AbstractWidgetController;
20
use TYPO3\CMS\Core\Database\DatabaseConnection;
21
use TYPO3\CMS\Core\Utility\GeneralUtility;
22
23
/**
24
 * Class LastSearchesController
25
 *
26
 * @author Frans Saris <[email protected]>
27
 * @author Timo Hund <[email protected]>
28
 * @package ApacheSolrForTypo3\Solr\ViewHelpers\Widget\Controller
29
 */
30
class LastSearchesController extends AbstractWidgetController
31
{
32
    /**
33
     * Last searches
34
     */
35 23
    public function indexAction()
36
    {
37 23
        $databaseConnection = $GLOBALS['TYPO3_DB'];
38 23
        $tsfe = $GLOBALS['TSFE'];
39 23
        $typoScriptConfiguration = $this->controllerContext->getTypoScriptConfiguration();
40 23
        $lastSearchesService = GeneralUtility::makeInstance(LastSearchesService::class, $typoScriptConfiguration, $tsfe, $databaseConnection);
41 23
        $this->view->assign('contentArguments', ['lastSearches' => $lastSearchesService->getLastSearches()]);
42 23
    }
43
}
44