Completed
Pull Request — 2.x (#43)
by jake
02:49 queued 50s
created

AnchorRaw   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 83.33%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 27
ccs 5
cts 6
cp 0.8333
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 11 1
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 ... />` tags without escaping the $text param.
14
 *
15
 * @package Aura.Html
16
 *
17
 */
18
class AnchorRaw extends AbstractHelper
19
{
20
    /**
21
     *
22
     * Returns an anchor tag with text left unescaped.
23
     *
24
     * @param string $href The anchor href specification.
25
     *
26
     * @param string $text The text for the anchor.
27
     *
28
     * @param array $attr Attributes for the anchor.
29
     *
30
     * @return string
31
     *
32
     */
33 2
    public function __invoke($href, $text, array $attr = array())
34
    {
35
        $base = array(
36
            'href' => $href,
37 2
        );
38
39 2
        unset($attr['href']);
40
41
        $attr = $this->escaper->attr(array_merge($base, $attr));
42 2
        return "<a $attr>$text</a>";
43 2
    }
44
}
45