Completed
Push — master ( 0ecd6b...9f36b3 )
by Tim
03:56
created

JsQuoteViewHelper   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 23
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A initializeArguments() 0 5 1
A render() 0 6 3
1
<?php
2
/**
3
 * Quote JS.
4
 */
5
namespace HDNET\Calendarize\ViewHelpers;
6
7
use TYPO3\CMS\Core\Utility\GeneralUtility;
8
9
/**
10
 * Quote JS.
11
 */
12
class JsQuoteViewHelper extends AbstractViewHelper
13
{
14
    /**
15
     * Init arguments
16
     */
17
    public function initializeArguments()
18
    {
19
        parent::initializeArguments();
20
        $this->registerArgument('content', 'string', 'Override content', false);
21
    }
22
23
    /**
24
     * Render the Quote JS information.
25
     *
26
     * @return string
27
     */
28
    public function render()
29
    {
30
        $content = $this->arguments['content'] === null || trim((string)$this->arguments['content']) === '' ? $this->renderChildren() : $this->arguments['content'];
31
32
        return GeneralUtility::quoteJSvalue($content);
33
    }
34
}
35