| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Extension\DiscussionTools\ThreadItem; |
| 4 |
|
| 5 |
use DateTimeImmutable; |
| 6 |
use DateTimeZone; |
| 7 |
use MediaWiki\Page\ProperPageIdentity; |
| 8 |
use MediaWiki\Revision\RevisionRecord; |
| 9 |
|
| 10 |
class DatabaseCommentItem extends DatabaseThreadItem implements CommentItem { |
| 11 |
use CommentItemTrait { |
| 12 |
getHeading as protected traitGetHeading; |
| 13 |
getSubscribableHeading as protected traitGetSubscribableHeading; |
| 14 |
} |
| 15 |
|
| 16 |
private string $timestamp; |
| 17 |
private string $author; |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
public function __construct( |
| 31 |
ProperPageIdentity $page, RevisionRecord $rev, |
| 32 |
string $name, string $id, ?DatabaseThreadItem $parent, $transcludedFrom, int $level, |
| 33 |
string $timestamp, string $author |
| 34 |
) { |
| 35 |
parent::__construct( $page, $rev, 'comment', $name, $id, $parent, $transcludedFrom, $level ); |
| 36 |
$this->timestamp = $timestamp; |
| 37 |
$this->author = $author; |
| 38 |
} |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
public function getAuthor(): string { |
| 44 |
return $this->author; |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
public function getTimestamp(): DateTimeImmutable { |
| 51 |
return new DateTimeImmutable( $this->timestamp, new DateTimeZone( 'UTC' ) ); |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
public function getHeading(): DatabaseHeadingItem { |
| 59 |
return $this->traitGetHeading(); |
| 60 |
} |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
public function getSubscribableHeading(): ?DatabaseHeadingItem { |
| 66 |
return $this->traitGetSubscribableHeading(); |
| 67 |
} |
| 68 |
} |