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