Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\DataModel\Entity\ItemId Class Reference
+ Inheritance diagram for Wikibase\DataModel\Entity\ItemId:
+ Collaboration diagram for Wikibase\DataModel\Entity\ItemId:

Public Member Functions

 __construct ( $idSerialization)
 
 getNumericId ()
 
 getEntityType ()
 
 __serialize ()
 This method replaces Serializable::serialize().
 
 __unserialize (array $data)
 This method replaces Serializable::unserialize().
 
- Public Member Functions inherited from Wikibase\DataModel\Entity\SerializableEntityId
 getSerialization ()
 
 __toString ()
 This is a human readable representation of the EntityId.
 
 equals ( $target)
 

Static Public Member Functions

static newFromNumber ( $numericId)
 Construct an ItemId given the numeric part of its serialization.
 

Public Attributes

const PATTERN = '/^Q[1-9]\d{0,9}\z/i'
 
- Public Attributes inherited from Wikibase\DataModel\Entity\SerializableEntityId
const PATTERN = '/^[^:]+\z/'
 
- Public Attributes inherited from Wikibase\DataModel\Entity\Int32EntityId
const MAX = 2147483647
 

Private Member Functions

 assertValidIdFormat ( $idSerialization)
 

Additional Inherited Members

- Protected Attributes inherited from Wikibase\DataModel\Entity\SerializableEntityId
 $serialization
 

Detailed Description

Since
0.5

Constructor & Destructor Documentation

◆ __construct()

Wikibase\DataModel\Entity\ItemId::__construct ( $idSerialization)
Parameters
string$idSerialization
Exceptions
InvalidArgumentException

Reimplemented from Wikibase\DataModel\Entity\SerializableEntityId.

Member Function Documentation

◆ __serialize()

Wikibase\DataModel\Entity\ItemId::__serialize ( )

This method replaces Serializable::serialize().

Do not call it manually. Also, consider using getSerialization() and an EntityIdParser instead of PHP serialization.

See also
https://www.php.net/manual/en/language.oop5.magic.php#object.serialize

Reimplemented from Wikibase\DataModel\Entity\SerializableEntityId.

◆ __unserialize()

Wikibase\DataModel\Entity\ItemId::__unserialize ( array $data)

This method replaces Serializable::unserialize().

Do not call it manually. Also, consider using getSerialization() and an EntityIdParser instead of PHP serialization.

See also
https://www.php.net/manual/en/language.oop5.magic.php#object.unserialize

Reimplemented from Wikibase\DataModel\Entity\SerializableEntityId.

◆ assertValidIdFormat()

Wikibase\DataModel\Entity\ItemId::assertValidIdFormat ( $idSerialization)
private

◆ getEntityType()

Wikibase\DataModel\Entity\ItemId::getEntityType ( )
Returns
string

Reimplemented from Wikibase\DataModel\Entity\SerializableEntityId.

◆ getNumericId()

Wikibase\DataModel\Entity\ItemId::getNumericId ( )
See also
Int32EntityId::getNumericId
Returns
int Guaranteed to be a distinct integer in the range [1..2147483647].

Implements Wikibase\DataModel\Entity\Int32EntityId.

◆ newFromNumber()

static Wikibase\DataModel\Entity\ItemId::newFromNumber ( $numericId)
static

Construct an ItemId given the numeric part of its serialization.

CAUTION: new usages of this method are discouraged. Typically you should avoid dealing with just the numeric part, and use the whole serialization. Not doing so in new code requires special justification.

Parameters
int | float | string$numericId
Returns
self
Exceptions
InvalidArgumentException

Member Data Documentation

◆ PATTERN

const Wikibase\DataModel\Entity\ItemId::PATTERN = '/^Q[1-9]\d{0,9}\z/i'
Since
0.5

The documentation for this class was generated from the following file: