Passed
Branch master (c87ba8)
by Christian
16:02
created

T3GeneralInformationWidget::renderWidgetContent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 12
nc 1
nop 0
dl 0
loc 16
rs 9.8666
c 0
b 0
f 0
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 TYPO3\CMS\Dashboard\Widgets;
19
20
use TYPO3\CMS\Core\Information\Typo3Information;
21
use TYPO3\CMS\Core\Information\Typo3Version;
22
use TYPO3\CMS\Fluid\View\StandaloneView;
23
24
/**
25
 * Concrete TYPO3 information widget
26
 *
27
 * This widget will give some general information about TYPO3 version and the version installed.
28
 *
29
 * There are no options available for this widget
30
 */
31
class T3GeneralInformationWidget implements WidgetInterface
32
{
33
    /**
34
     * @var WidgetConfigurationInterface
35
     */
36
    private $configuration;
37
38
    /**
39
     * @var StandaloneView
40
     */
41
    private $view;
42
43
    /**
44
     * @var array
45
     */
46
    private $options;
47
48
    public function __construct(
49
        WidgetConfigurationInterface $configuration,
50
        StandaloneView $view,
51
        array $options = []
52
    ) {
53
        $this->configuration = $configuration;
54
        $this->view = $view;
55
        $this->options = $options;
56
    }
57
58
    public function renderWidgetContent(): string
59
    {
60
        $typo3Information = new Typo3Information();
61
        $typo3Version = new Typo3Version();
62
63
        $this->view->setTemplate('Widget/T3GeneralInformationWidget');
64
        $this->view->assignMultiple([
65
            'title' => 'TYPO3 CMS ' . $typo3Version->getVersion(),
66
            'copyrightYear' => $typo3Information->getCopyrightYear(),
67
            'currentVersion' => $typo3Version->getVersion(),
68
            'donationUrl' => $typo3Information::URL_DONATE,
69
            'copyRightNotice' => $typo3Information->getCopyrightNotice(),
70
            'options' => $this->options,
71
            'configuration' => $this->configuration
72
        ]);
73
        return $this->view->render();
74
    }
75
}
76