Add optional $page parameter to DocumentItem->getComments()

This commit is contained in:
Kijin Sung 2024-10-09 20:11:03 +09:00
parent 1326a5e507
commit 47afd4848b

View file

@ -965,7 +965,7 @@ class DocumentItem extends BaseObject
return $this->get('comment_count'); return $this->get('comment_count');
} }
function getComments() function getComments(?int $page = null)
{ {
if(!$this->getCommentCount()) if(!$this->getCommentCount())
{ {
@ -979,7 +979,7 @@ class DocumentItem extends BaseObject
// cpage is a number of comment pages // cpage is a number of comment pages
$cpageStr = sprintf('%d_cpage', $this->document_srl); $cpageStr = sprintf('%d_cpage', $this->document_srl);
$cpage = Context::get($cpageStr); $cpage = $page ? $page : Context::get($cpageStr);
if(!$cpage) if(!$cpage)
{ {
$cpage = Context::get('cpage'); $cpage = Context::get('cpage');