29 private $suggestedTitle;
36 private $suggestedTitleID;
50 $suggestedTitleID =
null ) {
51 $this->score = $score;
53 if ( $suggestedTitle ) {
56 $this->suggestedTitleID = $suggestedTitleID;
72 public function setText( $text, $setTitle =
true ) {
74 if ( $setTitle && $text !==
'' && $text !==
null ) {
85 return $this->suggestedTitle;
92 $this->suggestedTitle = $title;
93 if ( $title !==
null ) {
94 $urlUtils = MediaWikiServices::getInstance()->getUrlUtils();
95 $this->url = $urlUtils->expand( $title->getFullURL(),
PROTO_CURRENT ) ??
false;
105 return $this->suggestedTitleID;
112 $this->suggestedTitleID = $suggestedTitleID;
128 $this->score = $score;
166 $suggestion =
new self( $score, $text );
168 $suggestion->setSuggestedTitle( Title::newFromText( $text ) );
static fromText( $score, $text)
Create suggestion from text Will also create a title if text if not empty.
getSuggestedTitleID()
Title ID in the case this suggestion is based on a title.
setText( $text, $setTitle=true)
Set the suggestion text.
setURL( $url)
Set the suggestion URL.
setSuggestedTitleID( $suggestedTitleID=null)
getSuggestedTitle()
Title object in the case this suggestion is based on a title.
setSuggestedTitle(?Title $title=null)
setScore( $score)
Set the suggestion score.
getURL()
Suggestion URL, can be the link to the Title or maybe in the future a link to the search results for ...
__construct( $score, $text=null, ?Title $suggestedTitle=null, $suggestedTitleID=null)
getScore()
Suggestion score.
getText()
The suggestion text.
static fromTitle( $score, Title $title)
Create suggestion from Title.