26 private $namespaceName;
38 public function __construct( $namespaceId, $namespaceName, $pageName ) {
39 if ( $namespaceId ===
null ) {
40 $this->namespaceId =
null;
42 $this->namespaceId = intval( $namespaceId );
44 $this->namespaceName = str_replace(
' ',
'_', $namespaceName );
45 $this->pageName = str_replace(
' ',
'_', $pageName );
53 return $this->namespaceId !==
null;
61 if ( $this->namespaceId ===
null ) {
62 throw new RuntimeException(
63 "Attempted to call getNamespaceId when the namespace ID is not known" );
65 return $this->namespaceId;
70 return $this->namespaceName;
75 return $this->pageName;
81 if ( $this->namespaceName ) {
82 $result .= $this->namespaceName .
':';
84 $result .= $this->pageName;
99 $name .=
'{ns' . $this->namespaceId .
'}';
103 $name .= $this->namespaceName .
':' . $this->pageName;
110class_alias( ForeignTitle::class,
'ForeignTitle' );