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

Public Member Functions

 __construct ( $idSerialization)
 
 getNumericId ()
 
 getEntityType ()
 
 __serialize ()
 This method replaces Serializable::serialize().
 
 serialize ()
 
 __unserialize (array $data)
 This method replaces Serializable::unserialize().
 
 unserialize ( $serialized)
 
- Public Member Functions inherited from Wikibase\DataModel\Entity\SerializableEntityId
 getSerialization ()
 
 getRepositoryName ()
 Returns '' for local IDs and the foreign repository name for foreign IDs.
 
 getLocalPart ()
 Returns the serialization without the first repository prefix.
 
 isForeign ()
 Returns true iff SerializableEntityId::getRepositoryName returns a non-empty string.
 
 __toString ()
 This is a human readable representation of the EntityId.
 
 equals ( $target)
 

Static Public Member Functions

static newFromNumber ( $numericId)
 Construct a NumericPropertyId given the numeric part of its serialization.
 
static newFromRepositoryAndNumber ( $repositoryName, $numericId)
 CAUTION: Use the full string serialization whenever you can and avoid using numeric IDs.
 
- Static Public Member Functions inherited from Wikibase\DataModel\Entity\SerializableEntityId
static splitSerialization ( $serialization)
 Returns an array with 3 elements: the foreign repository name as the first element, the local ID as the last element and everything that is in between as the second element.
 
static joinSerialization (array $parts)
 Builds an ID serialization from the parts returned by SerializableEntityId::splitSerialization.
 

Public Attributes

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

Private Member Functions

 assertValidIdFormat ( $idSerialization)
 

Additional Inherited Members

- Static Protected Member Functions inherited from Wikibase\DataModel\Entity\SerializableEntityId
static extractRepositoryNameAndLocalPart ( $serialization)
 Returns a pair (repository name, local part of ID) from the given ID serialization.
 
- Protected Attributes inherited from Wikibase\DataModel\Entity\SerializableEntityId
 $serialization
 
 $repositoryName
 
 $localPart
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented from Wikibase\DataModel\Entity\SerializableEntityId.

Member Function Documentation

◆ __serialize()

Wikibase\DataModel\Entity\NumericPropertyId::__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\NumericPropertyId::__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\NumericPropertyId::assertValidIdFormat ( $idSerialization)
private

◆ getEntityType()

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

Reimplemented from Wikibase\DataModel\Entity\SerializableEntityId.

◆ getNumericId()

Wikibase\DataModel\Entity\NumericPropertyId::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\NumericPropertyId::newFromNumber ( $numericId)
static

Construct a NumericPropertyId 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

◆ newFromRepositoryAndNumber()

static Wikibase\DataModel\Entity\NumericPropertyId::newFromRepositoryAndNumber ( $repositoryName,
$numericId )
static

CAUTION: Use the full string serialization whenever you can and avoid using numeric IDs.

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

◆ serialize()

Wikibase\DataModel\Entity\NumericPropertyId::serialize ( )
See also
Serializable::serialize
Returns
string

◆ unserialize()

Wikibase\DataModel\Entity\NumericPropertyId::unserialize ( $serialized)
See also
Serializable::unserialize
Parameters
string$serialized

Member Data Documentation

◆ PATTERN

const Wikibase\DataModel\Entity\NumericPropertyId::PATTERN = '/^P[1-9]\d{0,9}\z/i'

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