Completed
Pull Request — master (#1735)
by
unknown
03:01
created

ArticleTrait::setPagination()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace luya\web\jsonld;
4
5
/**
6
 * JsonLd - Article Trait
7
 *
8
 * @see http://schema.org/Article
9
 *
10
 * @author Alex Schmid <[email protected]>
11
 * @since 1.0.1
12
 */
13
trait ArticleTrait
14
{
15
    use CreativeWorkTrait;
16
17
    /**
18
     * @var string
19
     */
20
    private $_articleBody;
21
22
    /**
23
     * @return string
24
     */
25
    public function getArticleBody()
26
    {
27
        return $this->_articleBody;
28
    }
29
30
    /**
31
     * The actual body of the article.
32
     *
33
     * @param string $articleBody
34
     * @return Article|ArticleTrait
35
     */
36
    public function setArticleBody($articleBody)
37
    {
38
        $this->_articleBody = $articleBody;
39
        return $this;
40
    }
41
42
    /**
43
     * @var string
44
     */
45
    private $_articleSection;
46
47
    /**
48
     * @return string
49
     */
50
    public function getArticleSection()
51
    {
52
        return $this->_articleSection;
53
    }
54
55
    /**
56
     * Articles may belong to one or more 'sections' in a magazine or newspaper, such as Sports, Lifestyle, etc.
57
     *
58
     * @param string $articleSection
59
     * @return Article|ArticleTrait
60
     */
61
    public function setArticleSection($articleSection)
62
    {
63
        $this->_articleSection = $articleSection;
64
        return $this;
65
    }
66
67
    /**
68
     * @var int|string
69
     */
70
    private $_pageEnd;
71
72
    /**
73
     * @return int|string
74
     */
75
    public function getPageEnd()
76
    {
77
        return $this->_pageEnd;
78
    }
79
80
    /**
81
     * The page on which the work ends; for example "138" or "xvi".
82
     *
83
     * @param int|string $pageEnd
84
     * @return Article|ArticleTrait
85
     */
86
    public function setPageEnd($pageEnd)
87
    {
88
        $this->_pageEnd = $pageEnd;
89
        return $this;
90
    }
91
92
    /**
93
     * @var int|string
94
     */
95
    private $_pageStart;
96
97
    /**
98
     * @return int|string
99
     */
100
    public function getPageStart()
101
    {
102
        return $this->_pageStart;
103
    }
104
105
    /**
106
     * The page on which the work starts; for example "135" or "xiii".
107
     *
108
     * @param int|string $pageStart
109
     * @return Article|ArticleTrait
110
     */
111
    public function setPageStart($pageStart)
112
    {
113
        $this->_pageStart = $pageStart;
114
        return $this;
115
    }
116
117
    /**
118
     * @var string
119
     */
120
    private $_pagination;
121
122
    /**
123
     * @return string
124
     */
125
    public function getPagination()
126
    {
127
        return $this->_pagination;
128
    }
129
130
    /**
131
     * Any description of pages that is not separated into pageStart and pageEnd;
132
     * for example, "1-6, 9, 55" or "10-12, 46-49".
133
     *
134
     * @param string $pagination
135
     * @return Article|ArticleTrait
136
     */
137
    public function setPagination($pagination)
138
    {
139
        $this->_pagination = $pagination;
140
        return $this;
141
    }
142
143
    /**
144
     * @var SpeakableSpecification|URL
145
     */
146
    private $_speakable;
147
148
    /**
149
     * @return SpeakableSpecification|URL
150
     */
151
    public function getSpeakable()
152
    {
153
        return $this->_speakable;
154
    }
155
156
    /**
157
     * Indicates sections of a Web page that are particularly 'speakable' in the sense of being highlighted as being
158
     * especially appropriate for text-to-speech conversion. Other sections of a page may also be usefully spoken in
159
     * particular circumstances; the 'speakable' property serves to indicate the parts most likely
160
     * to be generally useful for speech.
161
     *
162
     * The speakable property can be repeated an arbitrary number of times,
163
     * with three kinds of possible 'content-locator' values:
164
     *
165
     * 1.) id-value URL references - uses id-value of an element in the page being annotated. The simplest use
166
     * of speakable has (potentially relative) URL values, referencing identified sections of the document concerned.
167
     *
168
     * 2.) CSS Selectors - addresses content in the annotated page, eg. via class attribute. Use the cssSelector property.
169
     *
170
     * 3.) XPaths - addresses content via XPaths (assuming an XML view of the content). Use the xpath property.
171
     *
172
     * For more sophisticated markup of speakable sections beyond simple ID references, either CSS selectors
173
     * or XPath expressions to pick out document section(s) as speakable. For this we define a supporting type,
174
     * SpeakableSpecification which is defined to be a possible value of the speakable property.
175
     *
176
     * @param SpeakableSpecification|URL $speakable
177
     * @return Article|ArticleTrait
178
     */
179
    public function setSpeakable($speakable)
180
    {
181
        $this->_speakable = $speakable;
182
        return $this;
183
    }
184
185
    /**
186
     * @var int
187
     */
188
    private $_wordCount;
189
190
    /**
191
     * @return int
192
     */
193
    public function getWordCount()
194
    {
195
        return $this->_wordCount;
196
    }
197
198
    /**
199
     * The number of words in the text of the Article.
200
     *
201
     * @param int $wordCount
202
     * @return Article|ArticleTrait
203
     */
204
    public function setWordCount($wordCount)
205
    {
206
        $this->_wordCount = $wordCount;
207
        return $this;
208
    }
209
}