ContentEditableNode   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 93.75%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 4
dl 0
loc 26
ccs 15
cts 16
cp 0.9375
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A compile() 0 20 3
1
<?php
2
3
/*
4
 * This file is part of the Ivoaz ContentEditable bundle.
5
 *
6
 * (c) Ivo Azirjans <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Ivoaz\Bundle\ContentEditableBundle\Twig;
13
14
/**
15
 * @author Ivo Azirjans <[email protected]>
16
 */
17
class ContentEditableNode extends \Twig_Node
18
{
19
    /**
20
     * @param \Twig_Compiler $compiler
21
     */
22 2
    public function compile(\Twig_Compiler $compiler)
23
    {
24 2
        $compiler->addDebugInfo($this);
25
26 2
        $body = $this->getNode('body');
27
28 2
        if ($body instanceof \Twig_Node_Expression_Constant) {
29
            $body = new \Twig_Node_Expression_Constant(trim($body->getAttribute('value')), $body->getLine());
30 2
        } elseif ($body instanceof \Twig_Node_Text) {
31 2
            $body = new \Twig_Node_Expression_Constant(trim($body->getAttribute('data')), $body->getLine());
32 2
        }
33
34 2
        $compiler->write('echo $this->env->getExtension(\'ivoaz_content_editable\')->render(')
35 2
            ->subcompile($body)
36 2
            ->raw(',')
37 2
            ->repr($this->getAttribute('name'))
38 2
            ->raw(',')
39 2
            ->repr($this->getAttribute('options'))
40 2
            ->raw(');');
41 2
    }
42
}
43