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

Metas::add()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1.0156

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 5
ccs 3
cts 4
cp 0.75
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
crap 1.0156
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 for a series of <meta ... /> tags.
14
 *
15
 * @package Aura.Html
16
 *
17
 */
18
class Metas extends AbstractSeries
19
{
20
    /**
21
     *
22
     * Adds a `<meta ...>` tag to the series.
23
     *
24
     * @param array $attr Attributes for the <link> tag.
25
     *
26
     * @param int $pos The meta position in the series.
27
     *
28
     * @return self
29
     *
30
     */
31 1
    public function add(array $attr = array(), $pos = 100)
32
    {
33
        $this->addElement($pos, $this->void('meta', $attr));
34 1
        return $this;
35 1
    }
36
37
    /**
38
     *
39
     * Returns a `<meta http-equiv="" content="">` tag.
40
     *
41
     * @param string $http_equiv The http-equiv type.
42
     *
43
     * @param string $content The content value.
44
     *
45
     * @param int $pos The meta position in the series.
46
     *
47
     * @return self
48
     *
49
     */
50 2
    public function addHttp($http_equiv, $content, $pos = 100)
51
    {
52
        $attr = array(
53
            'http-equiv' => $http_equiv,
54
            'content'    => $content,
55 2
        );
56
57
        return $this->add($attr, $pos);
58 2
    }
59
60
    /**
61
     *
62
     * Returns a `<meta name="" content="">` tag.
63
     *
64
     * @param string $name The name value.
65
     *
66
     * @param string $content The content value.
67
     *
68
     * @param int $pos The meta position in the series.
69
     *
70
     * @return self
71
     *
72
     */
73 2
    public function addName($name, $content, $pos = 100)
74
    {
75
        $attr = array(
76
            'name'    => $name,
77
            'content' => $content,
78 2
        );
79
80
        return $this->add($attr, $pos);
81 2
    }
82
}
83