2022-03-18 03:28:06 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace MediaWiki\Extension\DiscussionTools\ThreadItem;
|
|
|
|
|
|
|
|
use DateTimeImmutable;
|
2022-02-16 23:29:10 +00:00
|
|
|
use MediaWiki\Page\ProperPageIdentity;
|
|
|
|
use MediaWiki\Revision\RevisionRecord;
|
2022-03-18 03:28:06 +00:00
|
|
|
|
|
|
|
class DatabaseCommentItem extends DatabaseThreadItem implements CommentItem {
|
|
|
|
use CommentItemTrait {
|
|
|
|
getHeading as protected traitGetHeading;
|
|
|
|
getSubscribableHeading as protected traitGetSubscribableHeading;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @var string */
|
|
|
|
private $timestamp;
|
|
|
|
/** @var string */
|
|
|
|
private $author;
|
|
|
|
|
|
|
|
/**
|
2022-02-16 23:29:10 +00:00
|
|
|
* @param ProperPageIdentity $page
|
|
|
|
* @param RevisionRecord $rev
|
2022-03-18 03:28:06 +00:00
|
|
|
* @param string $name
|
|
|
|
* @param string $id
|
|
|
|
* @param DatabaseThreadItem|null $parent
|
|
|
|
* @param bool|string $transcludedFrom
|
|
|
|
* @param int $level
|
|
|
|
* @param string $timestamp
|
|
|
|
* @param string $author
|
|
|
|
*/
|
|
|
|
public function __construct(
|
2022-02-16 23:29:10 +00:00
|
|
|
ProperPageIdentity $page, RevisionRecord $rev,
|
2022-03-18 03:28:06 +00:00
|
|
|
string $name, string $id, ?DatabaseThreadItem $parent, $transcludedFrom, int $level,
|
|
|
|
string $timestamp, string $author
|
|
|
|
) {
|
2022-02-16 23:29:10 +00:00
|
|
|
parent::__construct( $page, $rev, 'comment', $name, $id, $parent, $transcludedFrom, $level );
|
2022-03-18 03:28:06 +00:00
|
|
|
$this->timestamp = $timestamp;
|
|
|
|
$this->author = $author;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
public function getAuthor(): string {
|
|
|
|
return $this->author;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
public function getTimestamp(): DateTimeImmutable {
|
|
|
|
return new DateTimeImmutable( $this->timestamp );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritDoc CommentItemTrait::getHeading
|
|
|
|
* @suppress PhanTypeMismatchReturnSuperType
|
|
|
|
*/
|
|
|
|
public function getHeading(): DatabaseHeadingItem {
|
|
|
|
return $this->traitGetHeading();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritDoc CommentItemTrait::getSubscribableHeading
|
|
|
|
*/
|
|
|
|
public function getSubscribableHeading(): ?DatabaseHeadingItem {
|
|
|
|
return $this->traitGetSubscribableHeading();
|
|
|
|
}
|
|
|
|
}
|