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
|
|
|
private $_articleBody; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @return string |
21
|
|
|
*/ |
22
|
|
|
public function getArticleBody() |
23
|
|
|
{ |
24
|
|
|
return $this->_articleBody; |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* The actual body of the article. |
29
|
|
|
* |
30
|
|
|
* @param string $articleBody |
31
|
|
|
* @return Article|ArticleTrait |
32
|
|
|
*/ |
33
|
|
|
public function setArticleBody($articleBody) |
34
|
|
|
{ |
35
|
|
|
$this->_articleBody = $articleBody; |
36
|
|
|
return $this; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
private $_articleSection; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @return string |
43
|
|
|
*/ |
44
|
|
|
public function getArticleSection() |
45
|
|
|
{ |
46
|
|
|
return $this->_articleSection; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Articles may belong to one or more 'sections' in a magazine or newspaper, such as Sports, Lifestyle, etc. |
51
|
|
|
* |
52
|
|
|
* @param string $articleSection |
53
|
|
|
* @return Article|ArticleTrait |
54
|
|
|
*/ |
55
|
|
|
public function setArticleSection($articleSection) |
56
|
|
|
{ |
57
|
|
|
$this->_articleSection = $articleSection; |
58
|
|
|
return $this; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
private $_pageEnd; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @return int|string |
65
|
|
|
*/ |
66
|
|
|
public function getPageEnd() |
67
|
|
|
{ |
68
|
|
|
return $this->_pageEnd; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* The page on which the work ends; for example "138" or "xvi". |
73
|
|
|
* |
74
|
|
|
* @param int|string $pageEnd |
75
|
|
|
* @return Article|ArticleTrait |
76
|
|
|
*/ |
77
|
|
|
public function setPageEnd($pageEnd) |
78
|
|
|
{ |
79
|
|
|
$this->_pageEnd = $pageEnd; |
80
|
|
|
return $this; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
private $_pageStart; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @return int|string |
87
|
|
|
*/ |
88
|
|
|
public function getPageStart() |
89
|
|
|
{ |
90
|
|
|
return $this->_pageStart; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* The page on which the work starts; for example "135" or "xiii". |
95
|
|
|
* |
96
|
|
|
* @param int|string $pageStart |
97
|
|
|
* @return Article|ArticleTrait |
98
|
|
|
*/ |
99
|
|
|
public function setPageStart($pageStart) |
100
|
|
|
{ |
101
|
|
|
$this->_pageStart = $pageStart; |
102
|
|
|
return $this; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
private $_pagination; |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* @return string |
109
|
|
|
*/ |
110
|
|
|
public function getPagination() |
111
|
|
|
{ |
112
|
|
|
return $this->_pagination; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Any description of pages that is not separated into pageStart and pageEnd; |
117
|
|
|
* for example, "1-6, 9, 55" or "10-12, 46-49". |
118
|
|
|
* |
119
|
|
|
* @param string $pagination |
120
|
|
|
* @return Article|ArticleTrait |
121
|
|
|
*/ |
122
|
|
|
public function setPagination($pagination) |
123
|
|
|
{ |
124
|
|
|
$this->_pagination = $pagination; |
125
|
|
|
return $this; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
private $_wordCount; |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @return int |
132
|
|
|
*/ |
133
|
|
|
public function getWordCount() |
134
|
|
|
{ |
135
|
|
|
return $this->_wordCount; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* The number of words in the text of the Article. |
140
|
|
|
* |
141
|
|
|
* @param int $wordCount |
142
|
|
|
* @return Article|ArticleTrait |
143
|
|
|
*/ |
144
|
|
|
public function setWordCount($wordCount) |
145
|
|
|
{ |
146
|
|
|
$this->_wordCount = $wordCount; |
147
|
|
|
return $this; |
148
|
|
|
} |
149
|
|
|
} |
150
|
|
|
|