80 if ( $this->
hasSite( $site->getGlobalId() ) ) {
84 $this->byGlobalId[$site->getGlobalId()] = $index;
85 $this->byInternalId[$site->getInternalId()] = $index;
87 $ids = $site->getNavigationIds();
88 foreach ( $ids
as $navId ) {
89 $this->byNavigationId[$navId] = $index;
103 if ( $this->offsetExists( $index ) ) {
107 $site = $this->offsetGet( $index );
109 unset( $this->byGlobalId[$site->getGlobalId()] );
110 unset( $this->byInternalId[$site->getInternalId()] );
112 $ids = $site->getNavigationIds();
113 foreach ( $ids
as $navId ) {
114 unset( $this->byNavigationId[$navId] );
118 parent::offsetUnset( $index );
130 return array_keys( $this->byGlobalId );
141 return array_key_exists( $globalSiteId, $this->byGlobalId );
155 return $this->offsetGet( $this->byGlobalId[$globalSiteId] );
167 $this->
offsetUnset( $this->byGlobalId[$globalSiteId] );
178 return $this->byGlobalId === [];
189 return array_key_exists( $id, $this->byInternalId );
203 return $this->offsetGet( $this->byInternalId[$id] );
226 return array_key_exists( $id, $this->byNavigationId );
240 return $this->offsetGet( $this->byNavigationId[$id] );
282 foreach ( $this
as $site ) {
283 if ( $site->getGroup() === $groupName ) {
299 const SERIAL_VERSION_ID =
'2014-03-17';
311 return self::SERIAL_VERSION_ID .
'+Site:' . Site::SERIAL_VERSION_ID;
325 parent::getSerializationData(),
327 'internalIds' => $this->byInternalId,
328 'globalIds' => $this->byGlobalId,
329 'navigationIds' => $this->byNavigationId
346 $this->byInternalId = $serializationData[
'internalIds'];
347 $this->byGlobalId = $serializationData[
'globalIds'];
348 $this->byNavigationId = $serializationData[
'navigationIds'];
350 return $serializationData;