Movatterモバイル変換


[0]ホーム

URL:


MediaWiki master
CommentStoreComment.php
Go to the documentation of this file.
1<?php
7namespaceMediaWiki\CommentStore;
8
9use InvalidArgumentException;
10useMediaWiki\Language\RawMessage;
11useMediaWiki\MediaWikiServices;
12useMediaWiki\Message\Message;
13
22classCommentStoreComment {
23
25public$id;
26
28public$text;
29
31public$message;
32
34public$data;
35
43publicfunction__construct($id,string$text, ?Message$message =null, ?array$data =null ) {
44 $this->id = (int)$id;
45 $this->text =$text;
46 $this->message =$message
47 ?:newRawMessage(
48'$1',
49 [Message::plaintextParam( $this->text ) ]
50 );
51 $this->data =$data;
52 }
53
63publicstaticfunctionnewUnsavedComment( $comment, ?array$data =null ) {
64if ( $comment instanceofCommentStoreComment ) {
65return $comment;
66 }
67
68if ($data !==null ) {
69foreach ($data as $k => $v ) {
70if ( str_starts_with( $k,'_' ) ) {
71thrownew InvalidArgumentException('Keys in $data beginning with "_" are reserved' );
72 }
73 }
74 }
75
76if ( $comment instanceofMessage ) {
77$message = clone $comment;
78// Avoid $wgForceUIMsgAsContentMsg
80 ->setInterfaceMessageFlag(true )
81 ->text();
83 }else {
84returnnewCommentStoreComment(null, $comment,null,$data );
85 }
86 }
87}
88
89// This alias can not be removed, because serialized instances of this class are stored in Echo
90// tables, until we either migrate to JSON serialization (T325703) or expire those events (T383948).
92class_alias( CommentStoreComment::class,'CommentStoreComment' );
MediaWiki\CommentStore\CommentStoreComment
Value object for a comment stored by CommentStore.
DefinitionCommentStoreComment.php:22
MediaWiki\CommentStore\CommentStoreComment\__construct
__construct( $id, string $text, ?Message $message=null, ?array $data=null)
DefinitionCommentStoreComment.php:43
MediaWiki\CommentStore\CommentStoreComment\newUnsavedComment
static newUnsavedComment( $comment, ?array $data=null)
Create a new, unsaved CommentStoreComment.
DefinitionCommentStoreComment.php:63
MediaWiki\CommentStore\CommentStoreComment\$id
int null $id
Comment ID, if any.
DefinitionCommentStoreComment.php:25
MediaWiki\CommentStore\CommentStoreComment\$text
string $text
Text version of the comment.
DefinitionCommentStoreComment.php:28
MediaWiki\CommentStore\CommentStoreComment\$message
Message $message
Message version of the comment.
DefinitionCommentStoreComment.php:31
MediaWiki\CommentStore\CommentStoreComment\$data
array null $data
Structured data of the comment.
DefinitionCommentStoreComment.php:34
MediaWiki\Language\RawMessage
Variant of the Message class.
DefinitionRawMessage.php:25
MediaWiki\MediaWikiServices
Service locator for MediaWiki core services.
DefinitionMediaWikiServices.php:256
MediaWiki\MediaWikiServices\getInstance
static getInstance()
Returns the global default instance of the top level service locator.
DefinitionMediaWikiServices.php:344
MediaWiki\Message\Message
The Message class deals with fetching and processing of interface message into a variety of formats.
DefinitionMessage.php:144
MediaWiki\Message\Message\inLanguage
inLanguage( $lang)
Request the message in any language that is supported.
DefinitionMessage.php:890
MediaWiki\Message\Message\plaintextParam
static plaintextParam( $plaintext)
DefinitionMessage.php:1341
MediaWiki\CommentStore
DefinitionCommentStore.php:7

[8]ページ先頭

©2009-2025 Movatter.jp