AbstractController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 5
dl 0
loc 35
ccs 0
cts 22
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A initializeStandaloneView() 0 15 1
A loadExtLocalconfDatabaseAndExtTables() 0 7 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Filoucrackeur\StorageFrameworkManager\Controller\Backend;
5
6
use Psr\Http\Message\ServerRequestInterface;
7
use TYPO3\CMS\Core\Core\Environment;
8
use TYPO3\CMS\Core\Utility\GeneralUtility;
9
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
10
use TYPO3\CMS\Fluid\View\StandaloneView;
11
12
class AbstractController extends ActionController
13
{
14
    const EXTENTION_NAME = 'storage_framework_manager';
15
16
    /**
17
     * @param ServerRequestInterface $request
18
     * @param string $templatePath
19
     * @return StandaloneView
20
     * @throws \TYPO3\CMS\Extbase\Mvc\Exception\InvalidExtensionNameException
21
     * @internal param string $template
22
     */
23
    protected function initializeStandaloneView(ServerRequestInterface $request, string $templatePath): StandaloneView
24
    {
25
        $viewRootPath = GeneralUtility::getFileAbsFileName('EXT:' . self::EXTENTION_NAME . '/Resources/Private/');
26
        $view = GeneralUtility::makeInstance(StandaloneView::class);
27
        $view->getRequest()->setControllerExtensionName('StorageFrameworkManager');
28
        $view->setTemplatePathAndFilename($viewRootPath . 'Templates/' . $templatePath);
29
        $view->setLayoutRootPaths([$viewRootPath . 'Layouts/']);
30
        $view->setPartialRootPaths([$viewRootPath . 'Partials/']);
31
        $view->assignMultiple([
32
            'controller' => $request->getQueryParams()['storageFrameworkManager']['controller'] ?? 'maintenance',
33
            'context' => $request->getQueryParams()['storageFrameworkManager']['context'] ?? '',
34
            'composerMode' => Environment::isComposerMode(),
35
        ]);
36
        return $view;
37
    }
38
39
    protected function loadExtLocalconfDatabaseAndExtTables(): void
40
    {
41
        \TYPO3\CMS\Core\Core\Bootstrap::loadTypo3LoadedExtAndExtLocalconf(false);
42
        \TYPO3\CMS\Core\Core\Bootstrap::unsetReservedGlobalVariables();
43
        \TYPO3\CMS\Core\Core\Bootstrap::loadBaseTca(false);
44
        \TYPO3\CMS\Core\Core\Bootstrap::loadExtTables(false);
45
    }
46
}
47