RenderBlock   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 7 2
1
<?php
2
3
namespace Faulancer\View\Helper;
4
5
use Faulancer\View\AbstractViewHelper;
6
7
/**
8
 * Class RenderBlock
9
 *
10
 * @package Faulancer\View\Helper
11
 * @author  Florian Knapp <[email protected]>
12
 */
13
class RenderBlock extends AbstractViewHelper
14
{
15
16
    /**
17
     * Render a defined block from variable
18
     *
19
     * @param string         $block
20
     * @param string         $defaultValue
21
     * @return array|string
22
     */
23
    public function __invoke(string $block, string $defaultValue = '')
24
    {
25
        if($this->view->getVariable($block) === '') {
26
            return $defaultValue;
27
        }
28
        return trim($this->view->getVariable($block));
29
    }
30
31
}