| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
namespace MediaWiki\Title; |
| 24 |
|
| 25 |
use MediaWiki\Linker\LinkTarget; |
| 26 |
use MediaWiki\Page\PageIdentity; |
| 27 |
use MediaWiki\Page\PageReference; |
| 28 |
use MessageLocalizer; |
| 29 |
use Wikimedia\Rdbms\IResultWrapper; |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
class TitleFactory { |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
public function newFromDBkey( $key ): ?Title { |
| 47 |
return Title::newFromDBkey( $key ); |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
public function newFromLinkTarget( LinkTarget $linkTarget, $forceClone = '' ): Title { |
| 57 |
return Title::newFromLinkTarget( $linkTarget, $forceClone ); |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
public function castFromLinkTarget( ?LinkTarget $linkTarget ): ?Title { |
| 66 |
return Title::castFromLinkTarget( $linkTarget ); |
| 67 |
} |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
public function newFromPageIdentity( PageIdentity $pageIdentity ): Title { |
| 76 |
return Title::newFromPageIdentity( $pageIdentity ); |
| 77 |
} |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
public function castFromPageIdentity( ?PageIdentity $pageIdentity ): ?Title { |
| 86 |
return Title::castFromPageIdentity( $pageIdentity ); |
| 87 |
} |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
public function newFromPageReference( PageReference $pageReference ): Title { |
| 96 |
return Title::newFromPageReference( $pageReference ); |
| 97 |
} |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
public function castFromPageReference( ?PageReference $pageReference ): ?Title { |
| 106 |
return Title::castFromPageReference( $pageReference ); |
| 107 |
} |
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
public function newFromText( $text, $defaultNamespace = NS_MAIN ): ?Title { |
| 117 |
return Title::newFromText( $text, $defaultNamespace ); |
| 118 |
} |
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
public function newFromTextThrow( $text, $defaultNamespace = NS_MAIN ): Title { |
| 128 |
return Title::newFromTextThrow( $text, $defaultNamespace ); |
| 129 |
} |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
public function newFromURL( $url ): ?Title { |
| 137 |
return Title::newFromURL( $url ); |
| 138 |
} |
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
public function newFromID( $id, $flags = 0 ): ?Title { |
| 147 |
return Title::newFromID( $id, $flags ); |
| 148 |
} |
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
public function newFromRow( $row ): Title { |
| 156 |
return Title::newFromRow( $row ); |
| 157 |
} |
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
public function makeTitle( $ns, $title, $fragment = '', $interwiki = '' ): Title { |
| 168 |
return Title::makeTitle( $ns, $title, $fragment, $interwiki ); |
| 169 |
} |
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
public function makeTitleSafe( $ns, $title, $fragment = '', $interwiki = '' ): ?Title { |
| 180 |
return Title::makeTitleSafe( $ns, $title, $fragment, $interwiki ); |
| 181 |
} |
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
public function newMainPage( ?MessageLocalizer $localizer = null ): Title { |
| 189 |
return Title::newMainPage( $localizer ); |
| 190 |
} |
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
public function newTitleArrayFromResult( IResultWrapper $result ) { |
| 198 |
return new TitleArrayFromResult( $result ); |
| 199 |
} |
| 200 |
|
| 201 |
} |
| 202 |
|
| 203 |
|
| 204 |
class_alias( TitleFactory::class, 'TitleFactory' ); |