Completed
Push — master ( 126c8c...32cbdd )
by Tim
15s queued 11s
created

RemoveBlankLinesViewHelper   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 26
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A renderStatic() 0 11 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace HDNET\Calendarize\ViewHelpers\Format;
6
7
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
8
9
/**
10
 * Class RemoveBlankLinesViewHelper.
11
 *
12
 * Removes blank lines (including spaces).
13
 */
14
class RemoveBlankLinesViewHelper extends \HDNET\Calendarize\ViewHelpers\AbstractViewHelper
15
{
16
    /**
17
     * @var bool
18
     */
19
    protected $escapeOutput = false;
20
21
    /**
22
     * @param array                     $arguments
23
     * @param \Closure                  $renderChildrenClosure
24
     * @param RenderingContextInterface $renderingContext
25
     *
26
     * @return string
27
     */
28
    public static function renderStatic(
29
        array $arguments,
30
        \Closure $renderChildrenClosure,
31
        RenderingContextInterface $renderingContext
32
    ): string {
33
        return trim(preg_replace(
34
            '/[\r\n]+\s*[\r\n]+/',
35
            "\n",
36
            $renderChildrenClosure()
37
        ));
38
    }
39
}
40