namespace = $namespace; $this->dbkey = $dbkey; $this->fragment = $fragment; } /** * @return int */ public function getNamespace() { return $this->namespace; } /** * @return string */ public function getFragment() { return $this->fragment; } /** * Returns the title's DB key, as supplied to the constructor, * without namespace prefix or fragment. * * @return string */ public function getDBkey() { return $this->dbkey; } /** * Returns the title in text form, * without namespace prefix or fragment. * * This is computed from the DB key by replacing any underscores with spaces. * * @note To get a title string that includes the namespace and/or fragment, * use a TitleFormatter. * * @return string */ public function getText() { return str_replace( '_', ' ', $this->getDBkey() ); } /** * Creates a new TitleValue for a different fragment of the same page. * * @param string $fragment The fragment name, or "" for the entire page. * * @return TitleValue */ public function createFragmentTitle( $fragment ) { return new TitleValue( $this->namespace, $this->dbkey, $fragment ); } /** * Returns a string representation of the title, for logging. This is purely informative * and must not be used programmatically. Use the appropriate TitleFormatter to generate * the correct string representation for a given use. * * @return string */ public function __toString() { $name = $this->namespace . ':' . $this->dbkey; if ( $this->fragment !== '' ) { $name .= '#' . $this->fragment; } return $name; } }