*/
protected $byGlobalId = array();
+ /**
+ * Navigational site identifiers alias inter-language prefixes
+ * pointing to their sites offset value.
+ *
+ * @since 1.23
+ *
+ * @var array of string
+ */
+ protected $byNavigationId = array();
+
/**
* @see GenericArrayObject::getObjectType
*
$this->byGlobalId[$site->getGlobalId()] = $index;
$this->byInternalId[$site->getInternalId()] = $index;
+ $ids = $site->getNavigationIds();
+ foreach ( $ids as $navId ) {
+ $this->byNavigationId[$navId] = $index;
+ }
+
return true;
}
unset( $this->byGlobalId[$site->getGlobalId()] );
unset( $this->byInternalId[$site->getInternalId()] );
+
+ $ids = $site->getNavigationIds();
+ foreach ( $ids as $navId ) {
+ unset( $this->byNavigationId[$navId] );
+ }
}
parent::offsetUnset( $index );
$this->offsetUnset( $this->byInternalId[$id] );
}
+ /**
+ * Returns if the list contains the site with the provided navigational site id.
+ *
+ * @param string $id
+ *
+ * @return boolean
+ */
+ public function hasNavigationId( $id ) {
+ return array_key_exists( $id, $this->byNavigationId );
+ }
+
+ /**
+ * Returns the Site with the provided navigational site id.
+ * The site needs to exist, so if not sure, call has first.
+ *
+ * @since 1.23
+ *
+ * @param string $id
+ *
+ * @return Site
+ */
+ public function getSiteByNavigationId( $id ) {
+ return $this->offsetGet( $this->byNavigationId[$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
+ *
+ * @param string $id
+ */
+ public function removeSiteByNavigationId( $id ) {
+ $this->offsetUnset( $this->byNavigationId[$id] );
+ }
+
/**
* Sets a site in the list. If the site was not there,
* it will be added. If it was, it will be updated.
* @var string A string uniquely identifying the version of the serialization structure,
* not including any sub-structures.
*/
- const SERIAL_VERSION_ID = '2013-01-23';
+ const SERIAL_VERSION_ID = '2014-03-17';
/**
* Returns the version ID that identifies the serialization structure used by
array(
'internalIds' => $this->byInternalId,
'globalIds' => $this->byGlobalId,
+ 'navigationIds' => $this->byNavigationId
)
);
}
$this->byInternalId = $serializationData['internalIds'];
$this->byGlobalId = $serializationData['globalIds'];
+ $this->byNavigationId = $serializationData['navigationIds'];
return $serializationData;
}
/**
* @deprecated
*/
-class SiteArray extends SiteList {}
\ No newline at end of file
+class SiteArray extends SiteList {}