MediaWiki master
MediaWiki\Site\SiteList Class Reference

Array-like collection of Site objects. More...

Inherits ArrayObject.

Collaboration diagram for MediaWiki\Site\SiteList:

Public Member Functions

 __construct ( $input=null, $flags=0, $iterator_class='ArrayIterator')
 
 __serialize ()
 
 __unserialize ( $serializationData)
 
 append ( $value)
 
 getGlobalIdentifiers ()
 Returns all the global site identifiers.
 
 getGroup ( $groupName)
 Returns the sites that are in the provided group.
 
 getObjectType ()
 The class or interface type that array elements must match.
 
 getSite ( $globalSiteId)
 Returns the Site with the provided global site identifier.
 
 getSiteByInternalId ( $id)
 Returns the Site with the provided site id.
 
 getSiteByNavigationId ( $id)
 Returns the Site with the provided navigational site id.
 
 hasInternalId ( $id)
 Returns if the list contains the site with the provided site id.
 
 hasNavigationId ( $id)
 Returns if the list contains the site with the provided navigational site id.
 
 hasSite ( $globalSiteId)
 Returns if the list contains the site with the provided global site identifier.
 
 isEmpty ()
 Whether the list contains no sites.
 
 offsetSet ( $index, $value)
 
 offsetUnset ( $index)
 
 removeSite ( $globalSiteId)
 Removes the site with the specified global site identifier.
 
 removeSiteByInternalId ( $id)
 Removes the site with the specified site id.
 
 removeSiteByNavigationId ( $id)
 Removes the site with the specified navigational site id.
 
 setSite (Site $site)
 Sets a site in the list.
 

Static Public Member Functions

static getSerialVersionId ()
 Returns the version ID that identifies the serialization structure used by __serialize() and unserialize(), including the structure of any nested structures.
 

Protected Member Functions

 getNewOffset ()
 Find a new offset for when appending an element.
 
 hasValidType ( $value)
 Returns if the provided value has the same type as the elements that can be added to this ArrayObject.
 
 setElement ( $index, $site)
 Actually set the element and enforce type checking and offset resolving.
 

Protected Attributes

array $byGlobalId = []
 Global site identifiers pointing to their sites offset value.
 
array $byInternalId = []
 Internal site identifiers pointing to their sites offset value.
 
array $byNavigationId = []
 Navigational site identifiers alias inter-language prefixes pointing to their sites offset value.
 
int $indexOffset = 0
 

Detailed Description

Array-like collection of Site objects.

This uses ArrayObject to intercept additions and deletions for purposes such as additional indexing, and to enforce that values are restricted to Site objects only.

Since
1.21
Author
Jeroen De Dauw < jeroe.nosp@m.nded.nosp@m.auw@g.nosp@m.mail.nosp@m..com >

Definition at line 23 of file SiteList.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Site\SiteList::__construct ( $input = null,
$flags = 0,
$iterator_class = 'ArrayIterator' )
See also
Overrides ArrayObject::__construct https://www.php.net/manual/en/arrayobject.construct.php
Since
1.20
Parameters
null | array$input
int$flags
string$iterator_class

Definition at line 66 of file SiteList.php.

References MediaWiki\Site\SiteList\offsetSet().

Member Function Documentation

◆ __serialize()

MediaWiki\Site\SiteList::__serialize ( )
See also
Overrides Serializable::serialize
Since
1.38
Returns
array

Definition at line 392 of file SiteList.php.

◆ __unserialize()

MediaWiki\Site\SiteList::__unserialize ( $serializationData)
See also
Overrides Serializable::unserialize
Since
1.38
Parameters
array$serializationData

Definition at line 411 of file SiteList.php.

◆ append()

MediaWiki\Site\SiteList::append ( $value)
See also
Overrides ArrayObject::append
Since
1.20
Parameters
mixed$value

Definition at line 81 of file SiteList.php.

◆ getGlobalIdentifiers()

MediaWiki\Site\SiteList::getGlobalIdentifiers ( )

Returns all the global site identifiers.

Optionally only those belonging to the specified group.

Since
1.21
Returns
array

Definition at line 203 of file SiteList.php.

◆ getGroup()

MediaWiki\Site\SiteList::getGroup ( $groupName)

Returns the sites that are in the provided group.

Since
1.21
Parameters
string$groupName
Returns
SiteList

Definition at line 349 of file SiteList.php.

◆ getNewOffset()

MediaWiki\Site\SiteList::getNewOffset ( )
protected

Find a new offset for when appending an element.

Since
1.20
Returns
int

Definition at line 124 of file SiteList.php.

◆ getObjectType()

MediaWiki\Site\SiteList::getObjectType ( )

The class or interface type that array elements must match.

Since
1.21
Returns
string

Definition at line 114 of file SiteList.php.

◆ getSerialVersionId()

static MediaWiki\Site\SiteList::getSerialVersionId ( )
static

Returns the version ID that identifies the serialization structure used by __serialize() and unserialize(), including the structure of any nested structures.

This is useful for constructing cache keys in cases where the cache relies on serialization for storing the SiteList.

Returns
string A string uniquely identifying the version of the serialization structure, including any sub-structures.

Definition at line 383 of file SiteList.php.

◆ getSite()

MediaWiki\Site\SiteList::getSite ( $globalSiteId)

Returns the Site with the provided global site identifier.

The site needs to exist, so if not sure, call hasGlobalId first.

Since
1.21
Parameters
string$globalSiteId
Returns
Site

Definition at line 228 of file SiteList.php.

Referenced by MediaWiki\Site\CachingSiteStore\getSite().

◆ getSiteByInternalId()

MediaWiki\Site\SiteList::getSiteByInternalId ( $id)

Returns the Site with the provided site id.

The site needs to exist, so if not sure, call has first.

Since
1.21
Parameters
int$id
Returns
Site

Definition at line 275 of file SiteList.php.

◆ getSiteByNavigationId()

MediaWiki\Site\SiteList::getSiteByNavigationId ( $id)

Returns the Site with the provided navigational site id.

The site needs to exist, so if not sure, call has first.

Since
1.23
Parameters
string$id
Returns
Site

Definition at line 312 of file SiteList.php.

◆ hasInternalId()

MediaWiki\Site\SiteList::hasInternalId ( $id)

Returns if the list contains the site with the provided site id.

Parameters
int$id
Returns
bool

Definition at line 261 of file SiteList.php.

◆ hasNavigationId()

MediaWiki\Site\SiteList::hasNavigationId ( $id)

Returns if the list contains the site with the provided navigational site id.

Parameters
string$id
Returns
bool

Definition at line 298 of file SiteList.php.

◆ hasSite()

MediaWiki\Site\SiteList::hasSite ( $globalSiteId)

Returns if the list contains the site with the provided global site identifier.

Parameters
string$globalSiteId
Returns
bool

Definition at line 214 of file SiteList.php.

Referenced by MediaWiki\Site\CachingSiteStore\getSite().

◆ hasValidType()

MediaWiki\Site\SiteList::hasValidType ( $value)
protected

Returns if the provided value has the same type as the elements that can be added to this ArrayObject.

Since
1.20
Parameters
mixed$value
Returns
bool

Definition at line 103 of file SiteList.php.

◆ isEmpty()

MediaWiki\Site\SiteList::isEmpty ( )

Whether the list contains no sites.

Since
1.21
Returns
bool

Definition at line 250 of file SiteList.php.

◆ offsetSet()

MediaWiki\Site\SiteList::offsetSet ( $index,
$value )
Since
1.20
See also
Overrides ArrayObject::offsetSet()
Parameters
mixed$index
mixed$value

Definition at line 91 of file SiteList.php.

Referenced by MediaWiki\Site\SiteList\__construct().

◆ offsetUnset()

MediaWiki\Site\SiteList::offsetUnset ( $index)
See also
ArrayObject::offsetUnset()
Since
1.21
Parameters
mixed$index

Definition at line 173 of file SiteList.php.

◆ removeSite()

MediaWiki\Site\SiteList::removeSite ( $globalSiteId)

Removes the site with the specified global site identifier.

The site needs to exist, so if not sure, call hasGlobalId first.

Since
1.21
Parameters
string$globalSiteId

Definition at line 240 of file SiteList.php.

◆ removeSiteByInternalId()

MediaWiki\Site\SiteList::removeSiteByInternalId ( $id)

Removes the site with the specified site id.

The site needs to exist, so if not sure, call has first.

Since
1.21
Parameters
int$id

Definition at line 287 of file SiteList.php.

◆ removeSiteByNavigationId()

MediaWiki\Site\SiteList::removeSiteByNavigationId ( $id)

Removes the site with the specified navigational site id.

The site needs to exist, so if not sure, call has first.

Since
1.23
Parameters
string$id

Definition at line 324 of file SiteList.php.

◆ setElement()

MediaWiki\Site\SiteList::setElement ( $index,
$site )
protected

Actually set the element and enforce type checking and offset resolving.

Since
1.20
Parameters
int | string | null$index
Site$site

Definition at line 139 of file SiteList.php.

◆ setSite()

MediaWiki\Site\SiteList::setSite ( Site $site)

Sets a site in the list.

If the site was not there, it will be added. If it was, it will be updated.

Since
1.21
Parameters
Site$site

Definition at line 336 of file SiteList.php.

Member Data Documentation

◆ $byGlobalId

array MediaWiki\Site\SiteList::$byGlobalId = []
protected

Global site identifiers pointing to their sites offset value.

Since
1.21

Maps string identifiers to local ArrayObject keys

Definition at line 47 of file SiteList.php.

◆ $byInternalId

array MediaWiki\Site\SiteList::$byInternalId = []
protected

Internal site identifiers pointing to their sites offset value.

Since
1.21

Maps int identifiers to local ArrayObject keys

Definition at line 38 of file SiteList.php.

◆ $byNavigationId

array MediaWiki\Site\SiteList::$byNavigationId = []
protected

Navigational site identifiers alias inter-language prefixes pointing to their sites offset value.

Since
1.23

Maps string identifiers to local ArrayObject keys

Definition at line 57 of file SiteList.php.

◆ $indexOffset

int MediaWiki\Site\SiteList::$indexOffset = 0
protected
See also
SiteList::getNewOffset()
Since
1.20

Definition at line 29 of file SiteList.php.


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