/** * Get comments for all the talks of a given event * * @param string $comment_uri * @param int $limit * @param int $start * @param bool $verbose * * @return array An array with two keys: * 'comments' holds the actual talk comment entities * 'pagination' holds pagination related meta data */ public function getTalkComments($comment_uri, $limit = 10, $start = 1, $verbose = false) { $comment_uri .= '?resultsperpage=' . $limit . '&start=' . $start; if ($verbose) { $comment_uri = $comment_uri . '&verbose=yes'; } $comments = (array) json_decode($this->apiGet($comment_uri)); $meta = array_pop($comments); $commentData = array(); foreach ($comments['comments'] as $item) { if (isset($item->user_uri)) { $item->username = $this->userApi->getUsername($item->user_uri); } $commentData['comments'][] = new TalkCommentEntity($item); } $commentData['pagination'] = $meta; return $commentData; }
/** * Get Comments for given talk * * @param $comment_uri * @param bool $verbose * @return Comment[] */ public function getComments($comment_uri, $verbose = false, $limitTo = null) { $params = []; if ($verbose) { $params['verbose'] = 'yes'; } if (null !== $limitTo) { $params['resultsperpage'] = $limitTo; } $comments = (array) json_decode($this->apiGet($comment_uri, $params)); $commentData = array(); foreach ($comments['comments'] as $item) { if (isset($item->user_uri)) { $item->username = $this->userApi->getUsername($item->user_uri); } $commentData[] = new TalkCommentEntity($item); } return $commentData; }