MediaWiki master
MediaWiki\Site\SiteList Class Reference

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

Inherits ArrayObject, and ArrayObject.

Collaboration diagram for MediaWiki\Site\SiteList:

Public Member Functions

 __construct ( $input=null, $flags=0, $iterator_class=ArrayIterator::class)
 
 __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 > <Site>

Definition at line 25 of file SiteList.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 68 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 397 of file SiteList.php.

◆ __unserialize()

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

Definition at line 416 of file SiteList.php.

◆ append()

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

Definition at line 83 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 205 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 354 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 126 of file SiteList.php.

◆ getObjectType()

MediaWiki\Site\SiteList::getObjectType ( )

The class or interface type that array elements must match.

Since
1.21
Returns
class-string<Site>

Definition at line 116 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 388 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 230 of file SiteList.php.

◆ 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.

Deprecated
since 1.47
Since
1.21
Parameters
int$id
Returns
Site

Definition at line 279 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 317 of file SiteList.php.

◆ hasInternalId()

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

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

Deprecated
since 1.47
Parameters
int$id
Returns
bool

Definition at line 264 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 303 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 216 of file SiteList.php.

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

◆ isEmpty()

MediaWiki\Site\SiteList::isEmpty ( )

Whether the list contains no sites.

Since
1.21
Returns
bool

Definition at line 252 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 93 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 175 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 242 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.

Deprecated
since 1.47
Since
1.21
Parameters
int$id

Definition at line 292 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 329 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 141 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 341 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 49 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 40 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 59 of file SiteList.php.

◆ $indexOffset

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

Definition at line 31 of file SiteList.php.


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