protected function mapSplObjectStorage(array $objectStorageValues = null, $createLazySplObjectStorage = false)
{
if ($objectStorageValues === null) {
return new \SplObjectStorage();
}
if ($createLazySplObjectStorage) {
$objectIdentifiers = [];
foreach ($objectStorageValues as $arrayValue) {
if ($arrayValue['value'] !== null) {
$objectIdentifiers[] = $arrayValue['value']['identifier'];
}
}
return new LazySplObjectStorage($objectIdentifiers);
} else {
$objectStorage = new \SplObjectStorage();
foreach ($objectStorageValues as $arrayValue) {
if ($arrayValue['value'] !== null) {
$objectStorage->attach($this->mapToObject($arrayValue['value']));
}
}
return $objectStorage;
}
}