Completed
Branch master (d17104)
by Christian
21:20
created

RequestInformation   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 49
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getContent() 0 10 1
A getDataToStore() 0 9 1
A getIdentifier() 0 3 1
A getLabel() 0 4 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace TYPO3\CMS\Adminpanel\Modules\Info;
5
6
/*
7
 * This file is part of the TYPO3 CMS project.
8
 *
9
 * It is free software; you can redistribute it and/or modify it under
10
 * the terms of the GNU General Public License, either version 2
11
 * of the License, or any later version.
12
 *
13
 * For the full copyright and license information, please read the
14
 * LICENSE.txt file that was distributed with this source code.
15
 *
16
 * The TYPO3 project - inspiring people to share!
17
 */
18
19
use Psr\Http\Message\ServerRequestInterface;
20
use TYPO3\CMS\Adminpanel\ModuleApi\AbstractSubModule;
21
use TYPO3\CMS\Adminpanel\ModuleApi\ContentProviderInterface;
22
use TYPO3\CMS\Adminpanel\ModuleApi\DataProviderInterface;
23
use TYPO3\CMS\Adminpanel\ModuleApi\ModuleData;
24
use TYPO3\CMS\Core\Utility\GeneralUtility;
25
use TYPO3\CMS\Fluid\View\StandaloneView;
26
27
/**
28
 * RequestInformation submodule of the admin panel
29
 *
30
 * @internal
31
 */
32
class RequestInformation extends AbstractSubModule implements DataProviderInterface, ContentProviderInterface
33
{
34
    /**
35
     * @inheritdoc
36
     */
37
    public function getIdentifier(): string
38
    {
39
        return 'info-request';
40
    }
41
42
    /**
43
     * @inheritdoc
44
     */
45
    public function getLabel(): string
46
    {
47
        return $this->getLanguageService()->sL(
48
            'LLL:EXT:adminpanel/Resources/Private/Language/locallang_info.xlf:sub.request.label'
49
        );
50
    }
51
52
    /**
53
     * @inheritdoc
54
     */
55
    public function getDataToStore(ServerRequestInterface $request): ModuleData
56
    {
57
        return new ModuleData(
58
            [
59
                'post' => $_POST,
60
                'get' => $_GET,
61
                'cookie' => $_COOKIE,
62
                'session' => $_SESSION,
63
                'server' => $_SERVER,
64
            ]
65
        );
66
    }
67
68
    /**
69
     * @inheritdoc
70
     */
71
    public function getContent(ModuleData $data): string
72
    {
73
        $view = GeneralUtility::makeInstance(StandaloneView::class);
74
        $templateNameAndPath = 'EXT:adminpanel/Resources/Private/Templates/Modules/Info/RequestInformation.html';
75
        $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($templateNameAndPath));
76
        $view->setPartialRootPaths(['EXT:adminpanel/Resources/Private/Partials']);
77
78
        $view->assignMultiple($data->getArrayCopy());
79
80
        return $view->render();
81
    }
82
}
83