CacheTagViewHelper::initializeArguments()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Qbus\Qbtools\ViewHelpers;
3
4
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
5
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
6
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
7
8
/**
9
 * CacheTagViewHelper
10
 *
11
 * @author Benjamin Franzke <[email protected]>
12
 * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
13
 */
14
class CacheTagViewHelper extends AbstractViewHelper
15
{
16
    use CompileWithRenderStatic;
17
18
    /**
19
     * Initialize arguments
20
     */
21
    public function initializeArguments()
22
    {
23
        $this->registerArgument('tag', 'string', '', true);
24
    }
25
26
    /**
27
     * @param array $arguments
28
     * @param \Closure $renderChildrenClosure
29
     * @param RenderingContextInterface $renderingContext
30
     * @return string
31
     */
32
    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
33
    {
34
        $tag = $arguments['tag'];
35
        $GLOBALS['TSFE']->addCacheTags([$tag]);
36
37
        return '';
38
    }
39
}
40