Skip to content
Permalink
Browse files

Only substr once.

  • Loading branch information...
markstory committed Feb 11, 2016
1 parent 312637d commit 4bb35bed3a1b83212befb156cbb93de8029c0e1b
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/Utility/Hash.php
@@ -939,9 +939,10 @@ public static function sort(array $data, $path, $dir = 'asc', $type = 'regular')
// the sorted value path.
$missingData = count($sortValues) < $dataCount;
if ($missingData && $numeric) {
// Get the path without the leading '{n}.'
$itemPath = substr($path, 4);
foreach ($data as $key => $value) {
// Get the value without the leading '{n}'.
$sortValues[$key] = static::get($value, substr($path, 4));
$sortValues[$key] = static::get($value, $itemPath);
}
} elseif ($missingData) {
$sortValues = array_pad($sortValues, $dataCount, null);

0 comments on commit 4bb35be

Please sign in to comment.
You can’t perform that action at this time.