Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\DataModel\Services\EntityId\SuffixEntityIdParser Class Reference

EntityIdParser that strips a fixed prefix and parses the remaining suffix as an EntityId. More...

+ Inheritance diagram for Wikibase\DataModel\Services\EntityId\SuffixEntityIdParser:
+ Collaboration diagram for Wikibase\DataModel\Services\EntityId\SuffixEntityIdParser:

Public Member Functions

 __construct ( $prefix, EntityIdParser $idParser)
 
 parse ( $idSerialization)
 Parses the given string into an EntityId by first stripping a fixed prefix.
 

Private Attributes

 $prefix
 
 $idParser
 

Detailed Description

EntityIdParser that strips a fixed prefix and parses the remaining suffix as an EntityId.

This can be used to parse entity URIs into EntityId objects.

Since
1.1
Author
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\DataModel\Services\EntityId\SuffixEntityIdParser::__construct ( $prefix,
EntityIdParser $idParser )
Parameters
string$prefixThe prefix to be stripped. Stripping is case sensitive.
EntityIdParser$idParser

Member Function Documentation

◆ parse()

Wikibase\DataModel\Services\EntityId\SuffixEntityIdParser::parse ( $idSerialization)

Parses the given string into an EntityId by first stripping a fixed prefix.

If the string does not start with the expected prefix, an EntityIdParsingException is thrown.

Parameters
string$idSerializationAn entity ID with some prefix attached, e.g. an entity URI.
Exceptions
EntityIdParsingExceptionIf the string does not start with the expected prefix, or the remaining suffix is not a valid entity ID string.
Returns
EntityId

Implements Wikibase\DataModel\Entity\EntityIdParser.

Member Data Documentation

◆ $idParser

Wikibase\DataModel\Services\EntityId\SuffixEntityIdParser::$idParser
private

◆ $prefix

Wikibase\DataModel\Services\EntityId\SuffixEntityIdParser::$prefix
private

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