Debian Codegraph @

extensions/DiscussionTools/includes/ThreadItem/DatabaseCommentItem.php

raw symbols SCIP
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 * @param ProperPageIdentity $page
21 * @param RevisionRecord $rev
22 * @param string $name
23 * @param string $id
24 * @param DatabaseThreadItem|null $parent
25 * @param bool|string $transcludedFrom
26 * @param int $level
27 * @param string $timestamp
28 * @param string $author
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 * @inheritDoc
42 */
43 public function getAuthor(): string {
44 return $this->author;
45 }
46
47 /**
48 * @inheritDoc
49 */
50 public function getTimestamp(): DateTimeImmutable {
51 return new DateTimeImmutable( $this->timestamp, new DateTimeZone( 'UTC' ) );
52 }
53
54 /**
55 * @inheritDoc CommentItemTrait::getHeading
56 * @suppress PhanTypeMismatchReturnSuperType
57 */
58 public function getHeading(): DatabaseHeadingItem {
59 return $this->traitGetHeading();
60 }
61
62 /**
63 * @inheritDoc CommentItemTrait::getSubscribableHeading
64 */
65 public function getSubscribableHeading(): ?DatabaseHeadingItem {
66 return $this->traitGetSubscribableHeading();
67 }
68 }