Completed
Pull Request — master (#325)
by Marc
02:06
created

RenderableClosure   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setClosure() 0 5 1
A render() 0 4 1
1
<?php
2
namespace TYPO3Fluid\Fluid\Core\Rendering;
3
4
/*
5
 * This file belongs to the package "TYPO3 Fluid".
6
 * See LICENSE.txt that was shipped with this package.
7
 */
8
9
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\NodeInterface;
10
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
11
12
/**
13
 * Class RenderableClosure
14
 */
15
class RenderableClosure extends AbstractRenderable
16
{
17
    /**
18
     * @var \Closure
19
     */
20
    protected $closure;
21
22
    /**
23
     * @param \Closure $closure
24
     * @return RenderableClosure
25
     */
26
    public function setClosure(\Closure $closure)
27
    {
28
        $this->closure = $closure;
29
        return $this;
30
    }
31
32
    /**
33
     * @param RenderingContextInterface $renderingContext
34
     * @return mixed
35
     */
36
    public function render(RenderingContextInterface $renderingContext)
37
    {
38
        return call_user_func_array($this->closure, [$renderingContext, $this->node]);
39
    }
40
}
41