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

NameMeta   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 109
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 8.69%

Importance

Changes 0
Metric Value
wmc 11
lcom 0
cbo 1
dl 0
loc 109
ccs 2
cts 23
cp 0.0869
rs 10
c 0
b 0
f 0

10 Methods

Rating   Name   Duplication   Size   Complexity  
A keywords() 0 4 1
A description() 0 4 1
A robots() 0 8 2
A author() 0 4 1
A copyright() 0 4 1
A documentState() 0 4 1
A generator() 0 4 1
A subject() 0 4 1
A url() 0 4 1
A revisit() 0 4 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