function uuid_entities_features_clean in Universally Unique IDentifier 7
Helper function to sort properties of an object.
This will maintain better consistency. Keys might get shifted order or type due to alterations sometimes.
1 call to uuid_entities_features_clean()
- uuid_entities_features_export_render in ./
uuid.features.inc - Implements [component]_features_export_render().
File
- ./
uuid.features.inc, line 187 - Features support to export entities from any Deploy <em>fetch-only</em> plan.
Code
function uuid_entities_features_clean(&$object) {
$properties = array();
foreach ($object as $key => $value) {
$properties[$key] = $value;
if (is_object($object)) {
unset($object->{$key});
}
elseif (is_array($object)) {
unset($object[$key]);
}
}
ksort($properties);
foreach ($properties as $key => $value) {
// Make properties type consistent.
if (is_string($value) || is_numeric($value)) {
if (is_object($object)) {
$object->{$key} = "{$value}";
}
elseif (is_array($object)) {
$object[$key] = "{$value}";
}
}
else {
if (is_object($object)) {
$object->{$key} = $value;
}
elseif (is_array($object)) {
$object[$key] = $value;
}
}
}
}