Completed
Pull Request — 2.x (#41)
by jake
02:03
created

Structure::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 12
ccs 7
cts 7
cp 1
rs 9.4286
cc 2
eloc 7
nc 2
nop 3
crap 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 snippet of nested HTML.
14
 *
15
 * @package Aura.Html
16
 *
17
 */
18
class Structure extends AbstractElement
19
{
20
    /**
21
     *
22
     * Returns any kind of nestd HTML elements with attributes.
23
     *
24
     * @param string $tag The tag to generate.
25
     *
26
     * @param string|array $content The element content
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
        if (is_array($content)) {
36 2
            return $this->raw(
37 2
                $tag,
38 2
                call_user_func_array($this, $content),
39
                $attr
40 2
            );
41
        }
42
43 2
        return $this->escaped($tag, $content, $attr);
44
    }
45
}
46