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

NameMeta::keywords()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Bankiru\Seo\Page;
4
5
final class NameMeta
6
{
7
    const DOCUMENT_STATE_STATIC  = 'static';
8
    const DOCUMENT_STATE_DYNAMIC = 'dynamic';
9
10
    /**
11
     * @param string[] $keywords
12
     *
13
     * @return HtmlMetaInterface
14
     */
15 2
    public static function keywords(array $keywords)
16
    {
17 2
        return HtmlMeta::createNameMeta('keywords', implode(',', $keywords));
18
    }
19
20
    /**
21
     * @param string $description
22
     *
23
     * @return HtmlMetaInterface
24
     */
25
    public static function description($description)
26
    {
27
        return HtmlMeta::createNameMeta('description', (string)$description);
28
    }
29
30
    /**
31
     * @param string|string[] $robots
32
     *
33
     * @return HtmlMetaInterface
34
     */
35
    public static function robots($robots)
36
    {
37
        if (is_array($robots)) {
38
            $robots = implode(',', $robots);
39
        }
40
41
        return HtmlMeta::createNameMeta('robots', (string)$robots);
42
    }
43
44
    /**
45
     * @param string $author
46
     *
47
     * @return HtmlMetaInterface
48
     */
49
    public static function author($author)
50
    {
51
        return HtmlMeta::createNameMeta('author', (string)$author);
52
    }
53
54
    /**
55
     * @param string $copyright
56
     *
57
     * @return HtmlMetaInterface
58
     */
59
    public static function copyright($copyright)
60
    {
61
        return HtmlMeta::createNameMeta('copyright', (string)$copyright);
62
    }
63
64
    /**
65
     * @param string $state
66
     *
67
     * @return HtmlMetaInterface
68
     */
69
    public static function documentState($state = self::DOCUMENT_STATE_DYNAMIC)
70
    {
71
        return HtmlMeta::createNameMeta('document-state', (string)$state);
72
    }
73
74
    /**
75
     * @param string $generator
76
     *
77
     * @return HtmlMetaInterface
78
     */
79
    public static function generator($generator)
80
    {
81
        return HtmlMeta::createNameMeta('generator', (string)$generator);
82
    }
83
84
    /**
85
     * @param string $subject
86
     *
87
     * @return HtmlMetaInterface
88
     */
89
    public static function subject($subject)
90
    {
91
        return HtmlMeta::createNameMeta('subject', (string)$subject);
92
    }
93
94
    /**
95
     * @param string $url
96
     *
97
     * @return HtmlMetaInterface
98
     */
99
    public static function url($url)
100
    {
101
        return HtmlMeta::createNameMeta('url', (string)$url);
102
    }
103
104
    /**
105
     * @param int $days
106
     *
107
     * @return HtmlMetaInterface
108
     */
109
    public static function revisit($days)
110
    {
111
        return HtmlMeta::createNameMeta('url', $days);
112
    }
113
}
114