MediaWiki master
|
Immutable value object representing a page reference. More...
Inherits Stringable, and MediaWiki\Page\PageReference.
Inherited by MediaWiki\Page\PageIdentityValue.
Public Member Functions | ||||
__construct (int $namespace, string $dbKey, $wikiId) | ||||
__toString () | ||||
Returns a string representation of the title, for logging. | ||||
getDBkey () | ||||
Get the page title in DB key form.
| ||||
getNamespace () | ||||
Returns the page's namespace number.The value returned by this method should represent a valid namespace, but this cannot be guaranteed in all cases.
| ||||
getWikiId () | ||||
Get the ID of the wiki provided to the constructor. | ||||
isSamePageAs (PageReference $other) | ||||
Checks whether the given PageReference refers to the same page as this PageReference.Two PageReference instances are considered to refer to the same page if they belong to the same wiki, and have the same namespace and DB key.
| ||||
Public Member Functions inherited from MediaWiki\DAO\WikiAwareEntity | ||||
assertWiki ( $wikiId) | ||||
Throws if $wikiId is different from the return value of getWikiId(). | ||||
Static Public Member Functions | |
static | localReference (int $namespace, string $dbKey) |
Create PageReference for a local page. | |
Immutable value object representing a page reference.
Instances of this class are expected to always represent a viewable pages, that is, pages that can at least potentially be visited on the wiki. This class may represent Special pages, but not interwiki links, section links, etc.
Code that deserializes instances of PageReferenceValue must ensure that the original meaning of the "local" Wiki ID is preserved: When an instance of PageReferenceValue is created with self::LOCAL as the Wiki ID on one wiki, gets serialized, stored, and later read and unserialized on another wiki, the value of the Wiki ID must be adjusted to refer to the original wiki.
Definition at line 43 of file PageReferenceValue.php.
MediaWiki\Page\PageReferenceValue::__construct | ( | int | $namespace, |
string | $dbKey, | ||
$wikiId ) |
int | $namespace | A valid namespace ID. Validation is the caller's responsibility! |
string | $dbKey | A valid DB key. Validation is the caller's responsibility! |
string | false | $wikiId | The Id of the wiki this page belongs to, or self::LOCAL for the local wiki. |
Definition at line 64 of file PageReferenceValue.php.
MediaWiki\Page\PageReferenceValue::__toString | ( | ) |
Returns a string representation of the title, for logging.
This is purely informative and must not be used programmatically.
Implements MediaWiki\Page\PageReference.
Definition at line 132 of file PageReferenceValue.php.
MediaWiki\Page\PageReferenceValue::getDBkey | ( | ) |
Get the page title in DB key form.
Implements MediaWiki\Page\PageReference.
Definition at line 111 of file PageReferenceValue.php.
MediaWiki\Page\PageReferenceValue::getNamespace | ( | ) |
Returns the page's namespace number.The value returned by this method should represent a valid namespace, but this cannot be guaranteed in all cases.
Implements MediaWiki\Page\PageReference.
Definition at line 102 of file PageReferenceValue.php.
MediaWiki\Page\PageReferenceValue::getWikiId | ( | ) |
Get the ID of the wiki provided to the constructor.
Implements MediaWiki\Page\PageReference.
Definition at line 93 of file PageReferenceValue.php.
MediaWiki\Page\PageReferenceValue::isSamePageAs | ( | PageReference | $other | ) |
Checks whether the given PageReference refers to the same page as this PageReference.Two PageReference instances are considered to refer to the same page if they belong to the same wiki, and have the same namespace and DB key.
PageReference | $other |
Implements MediaWiki\Page\PageReference.
Definition at line 118 of file PageReferenceValue.php.
|
static |
Create PageReference for a local page.
int | $namespace | |
string | $dbKey |
Definition at line 84 of file PageReferenceValue.php.
Referenced by MediaWiki\Api\ApiErrorFormatter\getDummyTitle().