Apply PSR-12 code style (#145)
[GitHub/WoltLab/com.woltlab.wcf.conversation.git] / files / lib / data / conversation / message / SearchResultConversationMessage.class.php
1 <?php
2
3 namespace wcf\data\conversation\message;
4
5 use wcf\data\conversation\Conversation;
6 use wcf\data\search\ISearchResultObject;
7 use wcf\system\request\LinkHandler;
8 use wcf\system\search\SearchResultTextParser;
9
10 /**
11 * Represents a list of search result.
12 *
13 * @author Marcel Werk
14 * @copyright 2001-2019 WoltLab GmbH
15 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
16 * @package WoltLabSuite\Core\Data\Conversation\Message
17 *
18 * @property-read string|null $subject
19 */
20 class SearchResultConversationMessage extends ViewableConversationMessage implements ISearchResultObject
21 {
22 /**
23 * conversation object
24 * @var Conversation
25 */
26 public $conversation;
27
28 /** @noinspection PhpMissingParentCallCommonInspection */
29
30 /**
31 * Returns the conversation object.
32 *
33 * @return Conversation
34 */
35 public function getConversation()
36 {
37 if ($this->conversation === null) {
38 $this->conversation = new Conversation(null, [
39 'conversationID' => $this->conversationID,
40 'subject' => $this->subject,
41 ]);
42 }
43
44 return $this->conversation;
45 }
46
47 /** @noinspection PhpMissingParentCallCommonInspection */
48
49 /**
50 * @inheritDoc
51 */
52 public function getFormattedMessage()
53 {
54 return SearchResultTextParser::getInstance()->parse(
55 $this->getDecoratedObject()->getSimplifiedFormattedMessage()
56 );
57 }
58
59 /**
60 * @inheritDoc
61 */
62 public function getSubject()
63 {
64 return $this->subject;
65 }
66
67 /**
68 * @inheritDoc
69 */
70 public function getLink($query = '')
71 {
72 if ($query) {
73 return LinkHandler::getInstance()->getLink('Conversation', [
74 'object' => $this->getConversation(),
75 'messageID' => $this->messageID,
76 'highlight' => \urlencode($query),
77 ], '#message' . $this->messageID);
78 }
79
80 return $this->getDecoratedObject()->getLink();
81 }
82
83 /** @noinspection PhpMissingParentCallCommonInspection */
84
85 /**
86 * @inheritDoc
87 */
88 public function getTime()
89 {
90 return $this->time;
91 }
92
93 /**
94 * @inheritDoc
95 */
96 public function getObjectTypeName()
97 {
98 return 'com.woltlab.wcf.conversation.message';
99 }
100
101 /**
102 * @inheritDoc
103 */
104 public function getContainerTitle()
105 {
106 return '';
107 }
108
109 /**
110 * @inheritDoc
111 */
112 public function getContainerLink()
113 {
114 return '';
115 }
116 }