mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-12-18 11:02:57 +00:00
880f9755e0
Rename ThreadItem to ContentThreadItem, then create a new ThreadItem interface containing only the methods that we'll be able to implement using only the persistently stored data (no parsing), then create a DatabaseThreadItem. Do the same for CommentItem and HeadingItem. ThreadItemSet gets a similar treatment, but it's basically only for Phan's type checking. (This is sad.) Change-Id: I1633049befe8ec169753b82eb876459af1f63fe8
54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\DiscussionTools\ThreadItem;
|
|
|
|
/**
|
|
* A thread item, either a heading or a comment
|
|
*/
|
|
interface ThreadItem {
|
|
/**
|
|
* @return string Thread ID
|
|
*/
|
|
public function getId(): string;
|
|
|
|
/**
|
|
* @return string Thread item name
|
|
*/
|
|
public function getName(): string;
|
|
|
|
/**
|
|
* @return string Thread item type
|
|
*/
|
|
public function getType(): string;
|
|
|
|
/**
|
|
* @return ThreadItem|null Parent thread item
|
|
*/
|
|
public function getParent(): ?ThreadItem;
|
|
|
|
/**
|
|
* @return ThreadItem[] Replies to this thread item
|
|
*/
|
|
public function getReplies(): array;
|
|
|
|
/**
|
|
* @return string|bool `false` if this item is not transcluded. A string if it's transcluded
|
|
* from a single page (the page title, in text form with spaces). `true` if it's transcluded, but
|
|
* we can't determine the source.
|
|
*/
|
|
public function getTranscludedFrom();
|
|
|
|
/**
|
|
* @return int Indentation level
|
|
*/
|
|
public function getLevel(): int;
|
|
|
|
/**
|
|
* @param bool $deep Whether to include full serialized comments in the replies key
|
|
* @param callable|null $callback Function to call on the returned serialized array, which
|
|
* will be passed into the serialized replies as well if $deep is used
|
|
* @return array JSON-serializable array
|
|
*/
|
|
public function jsonSerialize( bool $deep = false, ?callable $callback = null ): array;
|
|
}
|