Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\DataModel\ReferenceList Class Reference

List of Reference objects. More...

+ Inheritance diagram for Wikibase\DataModel\ReferenceList:
+ Collaboration diagram for Wikibase\DataModel\ReferenceList:

Public Member Functions

 __construct ( $references=[])
 
 addReference (Reference $reference, $index=null)
 Adds the provided reference to the list.
 
 addNewReference (... $snaks)
 
 hasReference (Reference $reference)
 Returns if the list contains a reference with the same hash as the provided reference.
 
 indexOf (Reference $reference)
 Returns the index of the Reference object or false if the Reference could not be found.
 
 removeReference (Reference $reference)
 Removes the reference with the same hash as the provided reference if such a reference exists in the list.
 
 hasReferenceHash ( $referenceHash)
 Returns if the list contains a reference with the provided hash.
 
 removeReferenceHash ( $referenceHash)
 Looks for the first Reference object in this list with the provided hash.
 
 getReference ( $referenceHash)
 Returns the first Reference object with the provided hash, or null if there is no such reference in the list.
 
 serialize ()
 
 __serialize ()
 
 __unserialize (array $data)
 
 unserialize ( $serialized)
 
 isEmpty ()
 
 getValueHash ()
 The hash is purely valuer based.
 
 equals ( $target)
 The comparison is done purely value based, ignoring the order of the elements in the array.
 
 count ()
 
 getIterator ()
 

Private Member Functions

 insertReferenceAtIndex (Reference $reference, $index)
 

Private Attributes

 $references = []
 

Detailed Description

List of Reference objects.

Since
0.1 Does not implement References anymore since 2.0 Does not extend SplObjectStorage since 5.0
Author
Jeroen De Dauw < jeroe.nosp@m.nded.nosp@m.auw@g.nosp@m.mail.nosp@m..com >
H. Snater < media.nosp@m.wiki.nosp@m.@snat.nosp@m.er.c.nosp@m.om >
Thiemo Kreuz
Bene* < benes.nosp@m.tar..nosp@m.wikim.nosp@m.edia.nosp@m.@gmai.nosp@m.l.co.nosp@m.m >

Constructor & Destructor Documentation

◆ __construct()

Wikibase\DataModel\ReferenceList::__construct ( $references = [])
Parameters
Reference[] | Traversable$references
Exceptions
InvalidArgumentException

Member Function Documentation

◆ __serialize()

Wikibase\DataModel\ReferenceList::__serialize ( )

◆ __unserialize()

Wikibase\DataModel\ReferenceList::__unserialize ( array $data)

◆ addNewReference()

Wikibase\DataModel\ReferenceList::addNewReference ( $snaks)
Since
1.1
Parameters
Snak...$snaks (passing a single Snak[] is still supported but deprecated)
Exceptions
InvalidArgumentException

◆ addReference()

Wikibase\DataModel\ReferenceList::addReference ( Reference $reference,
$index = null )

Adds the provided reference to the list.

Empty references are ignored.

Since
0.1
Parameters
Reference$reference
int | null$indexNew position of the added reference, or null to append.
Exceptions
InvalidArgumentException

◆ count()

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

◆ equals()

Wikibase\DataModel\ReferenceList::equals ( $target)

The comparison is done purely value based, ignoring the order of the elements in the array.

Since
0.3
Parameters
mixed$target
Returns
bool

◆ getIterator()

Wikibase\DataModel\ReferenceList::getIterator ( )
See also
IteratorAggregate::getIterator
Since
5.0
Returns
Iterator|Reference[]

◆ getReference()

Wikibase\DataModel\ReferenceList::getReference ( $referenceHash)

Returns the first Reference object with the provided hash, or null if there is no such reference in the list.

Since
0.3
Parameters
string$referenceHash
Returns
Reference|null

◆ getValueHash()

Wikibase\DataModel\ReferenceList::getValueHash ( )

The hash is purely valuer based.

Order of the elements in the array is not held into account.

Since
0.3
Returns
string

◆ hasReference()

Wikibase\DataModel\ReferenceList::hasReference ( Reference $reference)

Returns if the list contains a reference with the same hash as the provided reference.

Since
0.1
Parameters
Reference$reference
Returns
bool

◆ hasReferenceHash()

Wikibase\DataModel\ReferenceList::hasReferenceHash ( $referenceHash)

Returns if the list contains a reference with the provided hash.

Since
0.3
Parameters
string$referenceHash
Returns
bool

◆ indexOf()

Wikibase\DataModel\ReferenceList::indexOf ( Reference $reference)

Returns the index of the Reference object or false if the Reference could not be found.

Since
0.5
Parameters
Reference$reference
Returns
int|bool

◆ insertReferenceAtIndex()

Wikibase\DataModel\ReferenceList::insertReferenceAtIndex ( Reference $reference,
$index )
private
Parameters
Reference$reference
int$index

◆ isEmpty()

Wikibase\DataModel\ReferenceList::isEmpty ( )
Since
4.4
Returns
bool

◆ removeReference()

Wikibase\DataModel\ReferenceList::removeReference ( Reference $reference)

Removes the reference with the same hash as the provided reference if such a reference exists in the list.

Since
0.1
Parameters
Reference$reference

◆ removeReferenceHash()

Wikibase\DataModel\ReferenceList::removeReferenceHash ( $referenceHash)

Looks for the first Reference object in this list with the provided hash.

Removes all occurences of that object.

Since
0.3
Parameters
string$referenceHash`

◆ serialize()

Wikibase\DataModel\ReferenceList::serialize ( )
See also
Serializable::serialize
Since
2.1
Returns
string

◆ unserialize()

Wikibase\DataModel\ReferenceList::unserialize ( $serialized)
See also
Serializable::unserialize
Since
2.1
Parameters
string$serialized

Member Data Documentation

◆ $references

Wikibase\DataModel\ReferenceList::$references = []
private

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