39 private $namespaceName;
51 public function __construct( $namespaceId, $namespaceName, $pageName ) {
52 if ( $namespaceId ===
null ) {
53 $this->namespaceId =
null;
55 $this->namespaceId = intval( $namespaceId );
57 $this->namespaceName = str_replace(
' ',
'_', $namespaceName );
58 $this->pageName = str_replace(
' ',
'_', $pageName );
66 return $this->namespaceId !==
null;
74 if ( $this->namespaceId ===
null ) {
75 throw new RuntimeException(
76 "Attempted to call getNamespaceId when the namespace ID is not known" );
78 return $this->namespaceId;
83 return $this->namespaceName;
88 return $this->pageName;
94 if ( $this->namespaceName ) {
95 $result .= $this->namespaceName .
':';
97 $result .= $this->pageName;
112 $name .=
'{ns' . $this->namespaceId .
'}';
116 $name .= $this->namespaceName .
':' . $this->pageName;
123class_alias( ForeignTitle::class,
'ForeignTitle' );