MediaWiki REL1_39
NamespaceImportTitleFactory.php
Go to the documentation of this file.
1<?php
28 private $titleFactory;
29
31 private $ns;
32
38 public function __construct(
39 NamespaceInfo $namespaceInfo,
40 TitleFactory $titleFactory,
41 int $ns
42 ) {
43 if ( !$namespaceInfo->exists( $ns ) ) {
44 throw new MWException( "Namespace $ns doesn't exist on this wiki" );
45 }
46 $this->titleFactory = $titleFactory;
47 $this->ns = $ns;
48 }
49
58 public function createTitleFromForeignTitle( ForeignTitle $foreignTitle ) {
59 return $this->titleFactory->makeTitleSafe( $this->ns, $foreignTitle->getText() );
60 }
61}
A simple, immutable structure to hold the title of a page on a foreign MediaWiki installation.
MediaWiki exception.
A class to convert page titles on a foreign wiki (ForeignTitle objects) into page titles on the local...
__construct(NamespaceInfo $namespaceInfo, TitleFactory $titleFactory, int $ns)
createTitleFromForeignTitle(ForeignTitle $foreignTitle)
Determines which local title best corresponds to the given foreign title.
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
exists( $index)
Returns whether the specified namespace exists.
Creates Title objects.
Represents an object that can convert page titles on a foreign wiki (ForeignTitle objects) into page ...