Completed
Push — 2.x ( 304a47...ee01e1 )
by jake
01:59
created

ElementRaw   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 24
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 8 2
1
<?php
2
/**
3
 *
4
 * This file is part of Aura for PHP.
5
 *
6
 * @license http://opensource.org/licenses/bsd-license.php BSD
7
 *
8
 */
9
namespace Aura\Html\Helper;
10
11
/**
12
 *
13
 * Helper to generate a complete element without escaping the $content
14
 *
15
 * @package Aura.Html
16
 *
17
 */
18
class ElementRaw extends AbstractHelper
19
{
20
    /**
21
     *
22
     * Returns any kind of complete HTML element with attributes.
23
     *
24
     * @param string $tag The tag to generate.
25
     *
26
     * @param string $content The content of the element.
27
     *
28
     * @param array $attr Attributes for the tag.
29
     *
30
     * @return string
31
     *
32
     */
33 2
    public function __invoke($tag, $content, array $attr = array())
34
    {
35 2
        $attr = $this->escaper->attr($attr);
36 2
        $out = $attr ? "<{$tag} $attr>" : "<{$tag}>";
37 2
        $out .= $content;
38 2
        $out .= "</$tag>";
39 2
        return $out;
40
    }
41
}
42