Debian Codegraph @

includes/CommentFormatter/CommentItem.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\CommentFormatter;
4
5 use MediaWiki\Linker\LinkTarget;
6
7 /**
8 * An object to represent one of the inputs to a batch formatting operation.
9 *
10 * @since 1.38
11 * @newable
12 */
13 class CommentItem {
14 /**
15 * @var string
16 * @internal
17 */
18 public $comment;
19
20 /**
21 * @var LinkTarget|null
22 * @internal
23 */
24 public $selfLinkTarget;
25
26 /**
27 * @var bool|null
28 * @internal
29 */
30 public $samePage;
31
32 /**
33 * @var string|false|null
34 * @internal
35 */
36 public $wikiId;
37
38 /**
39 * @param string $comment The comment to format
40 */
41 public function __construct( string $comment ) {
42 $this->comment = $comment;
43 }
44
45 /**
46 * Set the self-link target.
47 *
48 * @param LinkTarget $selfLinkTarget The title used for fragment-only
49 * and section links, formerly $title.
50 * @return $this
51 */
52 public function selfLinkTarget( LinkTarget $selfLinkTarget ) {
53 $this->selfLinkTarget = $selfLinkTarget;
54 return $this;
55 }
56
57 /**
58 * Set the same-page flag.
59 *
60 * @param bool $samePage If true, self links are rendered with a fragment-
61 * only URL. Formerly $local.
62 * @return $this
63 */
64 public function samePage( $samePage = true ) {
65 $this->samePage = $samePage;
66 return $this;
67 }
68
69 /**
70 * ID of the wiki to link to (if not the local wiki), as used by WikiMap.
71 * This is used to render comments which are loaded from a foreign wiki.
72 * This only affects links which are syntactically internal -- it has no
73 * effect on interwiki links.
74 *
75 * @param string|false|null $wikiId
76 * @return $this
77 */
78 public function wikiId( $wikiId ) {
79 $this->wikiId = $wikiId;
80 return $this;
81 }
82 }