1 | <?php |
||
8 | class Discussion extends Entity |
||
9 | { |
||
10 | use StandardEntity; |
||
11 | |||
12 | protected $posts = []; |
||
13 | |||
14 | 67 | public function __construct(array $data) |
|
22 | |||
23 | /** |
||
24 | * Should always return "discussion" |
||
25 | * @return string |
||
26 | */ |
||
27 | 1 | public function getType() |
|
31 | |||
32 | /** |
||
33 | * Number of individual posts in the thread |
||
34 | * @return int |
||
35 | */ |
||
36 | 1 | public function getNumPosts() |
|
40 | |||
41 | /** |
||
42 | * Array containing all tags that Diffbot's AI concluded match the content. |
||
43 | * |
||
44 | * Note that these are *not* the meta tags as defined by the creator of the |
||
45 | * content, but machine learned ones. The format of the array is: |
||
46 | * |
||
47 | * [ |
||
48 | * [ |
||
49 | * "id": 133907, |
||
50 | * "count": 3, |
||
51 | * "prevalence": 0.3103448275862069, |
||
52 | * "label": "Apache HTTP Server", |
||
53 | * "type": "Http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#InformationEntity", |
||
54 | * "uri": "http://dbpedia.org/resource/Apache_HTTP_Server" |
||
55 | * ], |
||
56 | * [ |
||
57 | * "id": 208652, |
||
58 | * "count": 5, |
||
59 | * "prevalence": 0.5172413793103449, |
||
60 | * "label": "PHP", |
||
61 | * "type": "Http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#InformationEntity", |
||
62 | * "uri": "http://dbpedia.org/resource/PHP" |
||
63 | * ] |
||
64 | * ] |
||
65 | * |
||
66 | * @return array |
||
67 | */ |
||
68 | 1 | public function getTags() |
|
72 | |||
73 | /** |
||
74 | * Number of unique participants in the discussion thread or comments |
||
75 | * |
||
76 | * @return int |
||
77 | */ |
||
78 | 1 | public function getParticipants() |
|
82 | |||
83 | /** |
||
84 | * Number of pages in the thread concatenated to form the posts response. |
||
85 | * Use maxPages to define how many pages to concatenate. |
||
86 | * @see http://support.diffbot.com/automatic-apis/handling-multiple-page-articles/ |
||
87 | * @return int |
||
88 | */ |
||
89 | 1 | public function getNumPages() |
|
93 | |||
94 | /** |
||
95 | * Array of all page URLs concatenated in a multipage discussion. |
||
96 | * Empty array if article was not concatenated before being returned. |
||
97 | * @see http://support.diffbot.com/automatic-apis/handling-multiple-page-articles/ |
||
98 | * @return array |
||
99 | */ |
||
100 | 1 | public function getNextPages() |
|
104 | |||
105 | /** |
||
106 | * If discussion spans multiple pages, nextPage will return the subsequent |
||
107 | * page URL. |
||
108 | * @return string|null |
||
109 | */ |
||
110 | 1 | public function getNextPage() |
|
114 | |||
115 | /** |
||
116 | * Discussion service provider (e.g., Disqus, Facebook), if known. |
||
117 | * @return string|null |
||
118 | */ |
||
119 | 1 | public function getProvider() |
|
123 | |||
124 | /** |
||
125 | * URL of the discussion's RSS feed, if available. |
||
126 | * @return string|null |
||
127 | */ |
||
128 | 1 | public function getRssUrl() |
|
132 | |||
133 | /** |
||
134 | * @todo find out what this is |
||
135 | * @return float|null |
||
136 | */ |
||
137 | 1 | public function getConfidence() |
|
141 | |||
142 | /** |
||
143 | * Returns an array of posts or comments in discussion. |
||
144 | * Each post is a Post entity. |
||
145 | * |
||
146 | * @see Post |
||
147 | * @return array |
||
148 | */ |
||
149 | 15 | public function getPosts() |
|
153 | |||
154 | } |