Completed
Push — master ( 82ed85...e127d4 )
by Pavel
03:01
created

HtmlMeta::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 4
crap 1
1
<?php
2
3
namespace Bankiru\Seo\Page;
4
5
final class HtmlMeta implements HtmlMetaInterface
6
{
7
    private $name;
8
9
    private $content;
10
11
    private $attributes = [];
12
13
    private $httpEquiv;
14
15
    /**
16
     * HtmlMeta constructor.
17
     *
18
     * @param       $content
19
     * @param       $name
20
     * @param       $httpEquiv
21
     * @param array $attributes
22
     */
23 2
    private function __construct($content, $name = null, $httpEquiv = null, array $attributes = [])
24
    {
25 2
        $this->name       = $name;
26 2
        $this->content    = $content;
27 2
        $this->attributes = $attributes;
28 2
        $this->httpEquiv  = $httpEquiv;
29 2
    }
30
31
    public static function createHttpEquivMeta($header, $content, array $attributes = [])
32
    {
33
        return new static($content, null, $header, $attributes);
34
    }
35
36 2
    public static function createNameMeta($name, $content, array $attributes = [])
37
    {
38 2
        return new static($content, $name, null, $attributes);
39
    }
40
41
    /** @return string|null */
42 2
    public function getName()
43
    {
44 2
        return $this->name;
45
    }
46
47
    /** @return string */
48 2
    public function getContent()
49
    {
50 2
        return $this->content;
51
    }
52
53
    /** @return string[] */
54 1
    public function getAttributes()
55
    {
56 1
        return $this->attributes;
57
    }
58
59
    /** @return null|string */
60 2
    public function getHttpEquiv()
61
    {
62 2
        return $this->httpEquiv;
63
    }
64
}
65