Passed
Push — master ( d5a28b...d12ca0 )
by
unknown
17:01
created

DummyController::mainAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the TYPO3 CMS project.
5
 *
6
 * It is free software; you can redistribute it and/or modify it under
7
 * the terms of the GNU General Public License, either version 2
8
 * of the License, or any later version.
9
 *
10
 * For the full copyright and license information, please read the
11
 * LICENSE.txt file that was distributed with this source code.
12
 *
13
 * The TYPO3 project - inspiring people to share!
14
 */
15
16
namespace TYPO3\CMS\Backend\Controller;
17
18
use Psr\Http\Message\ResponseInterface;
19
use Psr\Http\Message\ServerRequestInterface;
20
use TYPO3\CMS\Backend\Template\ModuleTemplateFactory;
21
use TYPO3\CMS\Core\Http\HtmlResponse;
22
23
/**
24
 * '/empty' routing target returns dummy content.
25
 * @internal This class is a specific Backend controller implementation and is not considered part of the Public TYPO3 API.
26
 */
27
class DummyController
28
{
29
    protected ModuleTemplateFactory $moduleTemplateFactory;
30
31
    public function __construct(ModuleTemplateFactory $moduleTemplateFactory)
32
    {
33
        $this->moduleTemplateFactory = $moduleTemplateFactory;
34
    }
35
36
    /**
37
     * Return simple dummy content
38
     *
39
     * @return ResponseInterface the response with the content
40
     */
41
    public function mainAction(ServerRequestInterface $request): ResponseInterface
42
    {
43
        $moduleTemplate = $this->moduleTemplateFactory->create($request);
44
        $moduleTemplate->setTitle('Blank');
45
        $moduleTemplate->getDocHeaderComponent()->disable();
46
        return new HtmlResponse($moduleTemplate->renderContent());
47
    }
48
}
49