mediawiki-extensions-Discus.../includes/ThreadItem/DatabaseCommentItem.php
Bartosz Dziewoński 0024a94ba7 Store permalink data, implement Special:FindComment/GoToComment
Depends-On: I90656cc74bb1cb1f2f3c82ad51cfb164cb8a4a4b
Bug: T296801
Change-Id: I84187b303aa10a242c872088403f808df3d1f940
2022-08-11 01:19:47 +02:00

70 lines
1.7 KiB
PHP

<?php
namespace MediaWiki\Extension\DiscussionTools\ThreadItem;
use DateTimeImmutable;
use MediaWiki\Page\ProperPageIdentity;
use MediaWiki\Revision\RevisionRecord;
class DatabaseCommentItem extends DatabaseThreadItem implements CommentItem {
use CommentItemTrait {
getHeading as protected traitGetHeading;
getSubscribableHeading as protected traitGetSubscribableHeading;
}
/** @var string */
private $timestamp;
/** @var string */
private $author;
/**
* @param ProperPageIdentity $page
* @param RevisionRecord $rev
* @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(
ProperPageIdentity $page, RevisionRecord $rev,
string $name, string $id, ?DatabaseThreadItem $parent, $transcludedFrom, int $level,
string $timestamp, string $author
) {
parent::__construct( $page, $rev, 'comment', $name, $id, $parent, $transcludedFrom, $level );
$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();
}
}