in src/DynamoDb/Marshaler.php [256:299]
public function unmarshalValue(array $value, $mapAsObject = false)
{
$type = key($value);
$value = $value[$type];
switch ($type) {
case 'S':
case 'BOOL':
return $value;
case 'NULL':
return null;
case 'N':
if ($this->options['wrap_numbers']) {
return new NumberValue($value);
}
// Use type coercion to unmarshal numbers to int/float.
return $value + 0;
case 'M':
if ($mapAsObject) {
$data = new \stdClass;
foreach ($value as $k => $v) {
$data->$k = $this->unmarshalValue($v, $mapAsObject);
}
return $data;
}
// NOBREAK: Unmarshal M the same way as L, for arrays.
case 'L':
foreach ($value as $k => $v) {
$value[$k] = $this->unmarshalValue($v, $mapAsObject);
}
return $value;
case 'B':
return new BinaryValue($value);
case 'SS':
case 'NS':
case 'BS':
foreach ($value as $k => $v) {
$value[$k] = $this->unmarshalValue([$type[0] => $v]);
}
return new SetValue($value);
}
throw new \UnexpectedValueException("Unexpected type: {$type}.");
}