MediaWiki 1.41.2
SiteList Class Reference

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

Inherits ArrayObject.

Collaboration diagram for 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 32 of file SiteList.php.

Constructor & Destructor Documentation

◆ __construct()

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 75 of file SiteList.php.

References offsetSet().

Member Function Documentation

◆ __serialize()

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

Definition at line 396 of file SiteList.php.

◆ __unserialize()

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

Definition at line 415 of file SiteList.php.

◆ append()

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

Definition at line 90 of file SiteList.php.

◆ getGlobalIdentifiers()

SiteList::getGlobalIdentifiers ( )

Returns all the global site identifiers.

Optionally only those belonging to the specified group.

Since
1.21
Returns
array

Definition at line 207 of file SiteList.php.

◆ getGroup()

SiteList::getGroup ( $groupName)

Returns the sites that are in the provided group.

Since
1.21
Parameters
string$groupName
Returns
SiteList

Definition at line 353 of file SiteList.php.

◆ getNewOffset()

SiteList::getNewOffset ( )
protected

Find a new offset for when appending an element.

Since
1.20
Returns
int

Definition at line 133 of file SiteList.php.

◆ getObjectType()

SiteList::getObjectType ( )

The class or interface type that array elements must match.

Since
1.21
Returns
string

Definition at line 123 of file SiteList.php.

◆ getSerialVersionId()

static 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 387 of file SiteList.php.

◆ getSite()

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 232 of file SiteList.php.

Referenced by CachingSiteStore\getSite().

◆ getSiteByInternalId()

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 279 of file SiteList.php.

◆ getSiteByNavigationId()

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 316 of file SiteList.php.

◆ hasInternalId()

SiteList::hasInternalId ( $id)

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

Parameters
int$id
Returns
bool

Definition at line 265 of file SiteList.php.

◆ hasNavigationId()

SiteList::hasNavigationId ( $id)

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

Parameters
string$id
Returns
bool

Definition at line 302 of file SiteList.php.

◆ hasSite()

SiteList::hasSite ( $globalSiteId)

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

Parameters
string$globalSiteId
Returns
bool

Definition at line 218 of file SiteList.php.

Referenced by CachingSiteStore\getSite().

◆ hasValidType()

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 112 of file SiteList.php.

◆ isEmpty()

SiteList::isEmpty ( )

Whether the list contains no sites.

Since
1.21
Returns
bool

Definition at line 254 of file SiteList.php.

◆ offsetSet()

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

Definition at line 100 of file SiteList.php.

Referenced by __construct().

◆ offsetUnset()

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

Definition at line 180 of file SiteList.php.

◆ removeSite()

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 244 of file SiteList.php.

◆ removeSiteByInternalId()

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 291 of file SiteList.php.

◆ removeSiteByNavigationId()

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 328 of file SiteList.php.

◆ setElement()

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 148 of file SiteList.php.

◆ setSite()

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 340 of file SiteList.php.

Member Data Documentation

◆ $byGlobalId

array 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 56 of file SiteList.php.

◆ $byInternalId

array 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 47 of file SiteList.php.

◆ $byNavigationId

array 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 66 of file SiteList.php.

◆ $indexOffset

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

Definition at line 38 of file SiteList.php.


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