LinkMeta::render()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Pageon\Html\Meta\Item;
4
5
use Pageon\Html\Meta\MetaItem;
6
7
final class LinkMeta implements MetaItem
8
{
9
    /**
10
     * @var string
11
     */
12
    private $rel;
13
14
    /**
15
     * @var string
16
     */
17
    private $href;
18
19
    /**
20
     * @param string $rel
21
     * @param string $href
22
     *
23
     * @return MetaItem
24
     */
25 2
    public static function create(string $rel, string $href) : MetaItem {
26 2
        return new self($rel, $href);
27
    }
28
29
    /**
30
     * @return string
31
     */
32 1
    public function render(array $extra = []) : string {
33 1
        return "<link rel=\"{$this->rel}\" href=\"{$this->href}\">";
34
    }
35
36
    /**
37
     * LinkMeta constructor.
38
     *
39
     * @param string $rel
40
     * @param string $href
41
     */
42 2
    public function __construct(string $rel, string $href) {
43 2
        $this->rel = $rel;
44 2
        $this->href = $href;
45 2
    }
46
}
47