public static function sortResources(array &$resources, $propertyPath)
{
uasort($resources, function (ApiResource $a, ApiResource $b) use($propertyPath) {
$valueA = static::getNestedProperty($a, $propertyPath, false);
$valueB = static::getNestedProperty($b, $propertyPath, false);
switch (gettype($valueA)) {
case 'string':
return strcasecmp($valueA, $valueB);
case 'integer':
case 'double':
case 'boolean':
return $valueA - $valueB;
}
return 0;
});
return $resources;
}