81 if ( $this->
hasSite( $site->getGlobalId() ) ) {
85 $this->byGlobalId[$site->getGlobalId()] = $index;
86 $this->byInternalId[$site->getInternalId()] = $index;
88 $ids = $site->getNavigationIds();
89 foreach ( $ids
as $navId ) {
90 $this->byNavigationId[$navId] = $index;
104 if ( $this->offsetExists( $index ) ) {
108 $site = $this->offsetGet( $index );
110 unset( $this->byGlobalId[$site->getGlobalId()] );
111 unset( $this->byInternalId[$site->getInternalId()] );
113 $ids = $site->getNavigationIds();
114 foreach ( $ids
as $navId ) {
115 unset( $this->byNavigationId[$navId] );
119 parent::offsetUnset( $index );
131 return array_keys( $this->byGlobalId );
141 public function hasSite( $globalSiteId ) {
142 return array_key_exists( $globalSiteId, $this->byGlobalId );
155 public function getSite( $globalSiteId ) {
156 return $this->offsetGet( $this->byGlobalId[$globalSiteId] );
168 $this->
offsetUnset( $this->byGlobalId[$globalSiteId] );
179 return $this->byGlobalId ===
array();
190 return array_key_exists( $id, $this->byInternalId );
204 return $this->offsetGet( $this->byInternalId[$id] );
227 return array_key_exists( $id, $this->byNavigationId );
241 return $this->offsetGet( $this->byNavigationId[$id] );
277 public function getGroup( $groupName ) {
283 foreach ( $this
as $site ) {
284 if ( $site->getGroup() === $groupName ) {
326 parent::getSerializationData(),
328 'internalIds' => $this->byInternalId,
329 'globalIds' => $this->byGlobalId,
330 'navigationIds' => $this->byNavigationId
345 $serializationData = parent::unserialize( $serialization );
347 $this->byInternalId = $serializationData[
'internalIds'];
348 $this->byGlobalId = $serializationData[
'globalIds'];
349 $this->byNavigationId = $serializationData[
'navigationIds'];
351 return $serializationData;