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

TitleTagViewHelper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 22
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A renderStatic() 0 10 2
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