getTitleFactory()->newFromText( $title ); } if ( $title instanceof Title ) { return $this->setSubject( DIWikiPage::newFromTitle( $title ) ); } throw new RuntimeException( "Something went wrong" ); } /** * @since 2.0 * * @param DIWikiPage $subject */ public function setSubject( DIWikiPage $subject ) { $this->subject = $subject; return $this; } /** * @since 2.0 * * @param string|null $title * * @return SemanticData * @throws RuntimeException */ public function newEmptySemanticData( $title = null ) { if ( $title instanceof DIWikiPage ) { $this->setSubject( $title ); } elseif ( $title !== null ) { $this->setTitle( $title ); } if ( $this->subject !== null ) { return new SemanticData( $this->subject ); } throw new RuntimeException( "Something went wrong" ); } /** * @since 2.0 */ public function null() { $this->subject = null; return this; } }