public function parse(array $data, ParsingDispatcher $parsingDispatcher)
{
// @todo XSD says that no ObjectState elements is valid,
// but we should at least have one if setting new states to content?
if (!array_key_exists('ObjectState', $data) || !is_array($data['ObjectState']) || empty($data['ObjectState'])) {
throw new Exceptions\Parser("Missing or invalid 'ObjectState' elements for ContentObjectStates.");
}
$states = array();
foreach ($data['ObjectState'] as $rawStateData) {
if (!array_key_exists('_href', $rawStateData)) {
throw new Exceptions\Parser("Missing '_href' attribute for ObjectState.");
}
$states[] = new RestObjectState(new ObjectState(array('id' => $this->requestParser->parseHref($rawStateData['_href'], 'objectStateId'))), $this->requestParser->parseHref($rawStateData['_href'], 'objectStateGroupId'));
}
return $states;
}