Remove closure for php 5.3 compatibility.

This commit is contained in:
Dave Longley 2013-08-09 14:19:41 -04:00
parent 7b937b3fdc
commit 9ca43c5a40

View file

@ -2206,27 +2206,20 @@ class JsonLdProcessor {
} }
// handle index container (skip if value is not an object) // handle index container (skip if value is not an object)
else if($container === '@index' && is_object($value)) { else if($container === '@index' && is_object($value)) {
$processor = $this; $expanded_value = array();
$expand_index_map = function($active_property) use ( $value_keys = array_keys((array)$value);
$processor, $active_ctx, $options, $value) { sort($value_keys);
$rval = array(); foreach($value_keys as $value_key) {
$keys = array_keys((array)$value); $val = $value->{$value_key};
sort($keys); $val = self::arrayify($val);
foreach($keys as $key) { $val = $this->_expand($active_ctx, $key, $val, $options, false);
$val = $value->{$key}; foreach($val as $item) {
$val = JsonLdProcessor::arrayify($val); if(!property_exists($item, '@index')) {
$val = $processor->_expand( $item->{'@index'} = $value_key;
$active_ctx, $active_property, $val, $options, false);
foreach($val as $item) {
if(!property_exists($item, '@index')) {
$item->{'@index'} = $key;
}
$rval[] = $item;
} }
$expanded_value[] = $item;
} }
return $rval; }
};
$expanded_value = $expand_index_map($key);
} }
else { else {
// recurse into @list or @set keeping the active property // recurse into @list or @set keeping the active property