Wikibase
MediaWiki Wikibase extension
Wikibase\DataModel\Statement\StatementByGuidMap Class Reference

Ordered and unique collection of Statement objects. More...

+ Inheritance diagram for Wikibase\DataModel\Statement\StatementByGuidMap:
+ Collaboration diagram for Wikibase\DataModel\Statement\StatementByGuidMap:

Public Member Functions

 __construct ( $statements=[])
 
 addStatement (Statement $statement)
 If the provided statement has a GUID not yet in the map, it will be appended to the map. More...
 
 hasStatementWithGuid ( $statementGuid)
 
 getStatementByGuid ( $statementGuid)
 
 removeStatementWithGuid ( $statementGuid)
 Removes the statement with the specified GUID if it exists. More...
 
 count ()
 
 getIterator ()
 The iterator has the GUIDs of the statements as keys. More...
 
 toArray ()
 Returns the map in array form. More...
 

Private Member Functions

 assertIsStatementGuid ( $statementGuid)
 

Private Attributes

 $statements = []
 

Detailed Description

Ordered and unique collection of Statement objects.

Can only contain Statements that have a non-null GUID.

Provides indexed access by Statement GUID. Does not provide complex modification functionality.

Since
3.0
Author
Jeroen De Dauw < jeroe.nosp@m.nded.nosp@m.auw@g.nosp@m.mail.nosp@m..com >
Kai Nissen < kai.n.nosp@m.isse.nosp@m.n@wik.nosp@m.imed.nosp@m.ia.de >

Constructor & Destructor Documentation

◆ __construct()

Wikibase\DataModel\Statement\StatementByGuidMap::__construct (   $statements = [])
Parameters
Statement[] | Traversable$statements

Member Function Documentation

◆ addStatement()

Wikibase\DataModel\Statement\StatementByGuidMap::addStatement ( Statement  $statement)

If the provided statement has a GUID not yet in the map, it will be appended to the map.

If the GUID is already in the map, the statement with this guid will be replaced.

Exceptions
InvalidArgumentException
Parameters
Statement$statement

◆ assertIsStatementGuid()

Wikibase\DataModel\Statement\StatementByGuidMap::assertIsStatementGuid (   $statementGuid)
private

◆ count()

Wikibase\DataModel\Statement\StatementByGuidMap::count ( )
See also
Countable::count
Returns
int

◆ getIterator()

Wikibase\DataModel\Statement\StatementByGuidMap::getIterator ( )

The iterator has the GUIDs of the statements as keys.

See also
IteratorAggregate::getIterator
Returns
Iterator|Statement[]

◆ getStatementByGuid()

Wikibase\DataModel\Statement\StatementByGuidMap::getStatementByGuid (   $statementGuid)
Parameters
string$statementGuid
Returns
Statement|null

◆ hasStatementWithGuid()

Wikibase\DataModel\Statement\StatementByGuidMap::hasStatementWithGuid (   $statementGuid)
Parameters
string$statementGuid
Returns
bool
Exceptions
InvalidArgumentException

◆ removeStatementWithGuid()

Wikibase\DataModel\Statement\StatementByGuidMap::removeStatementWithGuid (   $statementGuid)

Removes the statement with the specified GUID if it exists.

Parameters
string$statementGuid

◆ toArray()

Wikibase\DataModel\Statement\StatementByGuidMap::toArray ( )

Returns the map in array form.

The array keys are the GUIDs of their associated statement.

Returns
Statement[]

Member Data Documentation

◆ $statements

Wikibase\DataModel\Statement\StatementByGuidMap::$statements = []
private

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