Passed
Push — master ( 2afdeb...b846a2 )
by Nikolaos
06:23 queued 03:51
created

Link   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 36
ccs 12
cts 12
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTag() 0 3 1
A add() 0 18 1
1
<?php
2
3
/**
4
 * This file is part of the Phalcon Framework.
5
 *
6
 * For the full copyright and license information, please view the LICENSE.md
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace Phalcon\Html\Helper;
13
14
/**
15
 * Class Link
16
 */
17
class Link extends AbstractSeries
18
{
19
    /**
20
     * Add an element to the list
21
     *
22
     * @param string $rel
23
     * @param string $href
24
     *
25
     * @return Link
26
     */
27 1
    public function add(string $rel, string $href): Link
28
    {
29
        $attributes = [
30 1
            'rel'  => $rel,
31 1
            'href' => $href,
32
        ];
33
34 1
        $this->store[] = [
35 1
            "renderTag",
36
            [
37 1
                $this->getTag(),
38 1
                $attributes,
39 1
                "/",
40
            ],
41 1
            $this->indent(),
42
        ];
43
44 1
        return $this;
45
    }
46
47
    /**
48
     * @return string
49
     */
50 1
    protected function getTag(): string
51
    {
52 1
        return 'link';
53
    }
54
}
55