Completed
Push — master ( d98ce7...dac61c )
by Tim
02:22
created

TitleTagViewHelper::renderStatic()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 6
nc 2
nop 3
1
<?php
2
3
/**
4
 * TitleTagViewHelper.
5
 */
6
declare(strict_types=1);
7
8
namespace HDNET\Calendarize\ViewHelpers;
9
10
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
11
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
12
13
/**
14
 * TitleTagViewHelper.
15
 *
16
 * @see https://github.com/georgringer/news/blob/master/Classes/ViewHelpers/TitleTagViewHelper.php
17
 */
18
class TitleTagViewHelper extends AbstractViewHelper
19
{
20
    use CompileWithRenderStatic;
21
22
    /**
23
     * @param array                     $arguments
24
     * @param \Closure                  $renderChildrenClosure
25
     * @param RenderingContextInterface $renderingContext
26
     *
27
     * @return string
28
     */
29
    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
30
    {
31
        $content = \trim($renderChildrenClosure());
32
        if (!empty($content)) {
33
            $GLOBALS['TSFE']->altPageTitle = $content;
34
            $GLOBALS['TSFE']->indexedDocTitle = $content;
35
        }
36
37
        return '';
38
    }
39
}
40