MediaWiki  master
TitleFactory.php
Go to the documentation of this file.
1 <?php
24 
33 class TitleFactory {
34 
40  public function newFromDBkey( $key ) : ?Title {
41  return Title::newFromDBkey( $key );
42  }
43 
50  public function newFromLinkTarget( LinkTarget $linkTarget, $forceClone = '' ) : Title {
51  return Title::newFromLinkTarget( $linkTarget, $forceClone );
52  }
53 
59  public function castFromLinkTarget( ?LinkTarget $linkTarget ) : ?Title {
60  return Title::castFromLinkTarget( $linkTarget );
61  }
62 
70  public function newFromText( $text, $defaultNamespace = NS_MAIN ) : ?Title {
71  return Title::newFromText( $text, $defaultNamespace );
72  }
73 
81  public function newFromTextThrow( $text, $defaultNamespace = NS_MAIN ) : Title {
82  return Title::newFromTextThrow( $text, $defaultNamespace );
83  }
84 
90  public function newFromURL( $url ) : ?Title {
91  return Title::newFromURL( $url );
92  }
93 
100  public function newFromID( $id, $flags = 0 ) : ?Title {
101  return Title::newFromID( $id, $flags );
102  }
103 
109  public function newFromIDs( $ids ) : array {
110  return Title::newFromIDs( $ids );
111  }
112 
118  public function newFromRow( $row ) : Title {
119  return Title::newFromRow( $row );
120  }
121 
130  public function makeTitle( $ns, $title, $fragment = '', $interwiki = '' ) : Title {
131  return Title::makeTitle( $ns, $title, $fragment, $interwiki );
132  }
133 
142  public function makeTitleSafe( $ns, $title, $fragment = '', $interwiki = '' ) : ?Title {
143  return Title::makeTitleSafe( $ns, $title, $fragment, $interwiki );
144  }
145 
151  public function newMainPage( MessageLocalizer $localizer = null ) : Title {
152  return Title::newMainPage( $localizer );
153  }
154 
155 }
static castFromLinkTarget( $linkTarget)
Same as newFromLinkTarget, but if passed null, returns null.
Definition: Title.php:293
static newFromID( $id, $flags=0)
Create a new Title from an article ID.
Definition: Title.php:465
const NS_MAIN
Definition: Defines.php:60
static newMainPage(MessageLocalizer $localizer=null)
Create a new Title for the Main Page.
Definition: Title.php:646
castFromLinkTarget(?LinkTarget $linkTarget)
newFromDBkey( $key)
static newFromRow( $row)
Make a Title object from a DB row.
Definition: Title.php:516
newFromURL( $url)
newFromIDs( $ids)
makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
static newFromIDs( $ids)
Make an array of titles from an array of IDs.
Definition: Title.php:490
newFromText( $text, $defaultNamespace=NS_MAIN)
static newFromTextThrow( $text, $defaultNamespace=NS_MAIN)
Like Title::newFromText(), but throws MalformedTitleException when the title is invalid, rather than returning null.
Definition: Title.php:352
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:610
static newFromLinkTarget(LinkTarget $linkTarget, $forceClone='')
Returns a Title given a LinkTarget.
Definition: Title.php:269
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:584
static newFromDBkey( $key)
Create a new Title from a prefixed DB key.
Definition: Title.php:230
newMainPage(MessageLocalizer $localizer=null)
static newFromURL( $url)
THIS IS NOT THE FUNCTION YOU WANT.
Definition: Title.php:402
makeTitle( $ns, $title, $fragment='', $interwiki='')
newFromRow( $row)
newFromID( $id, $flags=0)
newFromLinkTarget(LinkTarget $linkTarget, $forceClone='')
newFromTextThrow( $text, $defaultNamespace=NS_MAIN)
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:317