Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
chore: removing original function no longer getting used
  • Loading branch information
bolt-bot committed Oct 30, 2017
commit ddc3a48f6561c93bee661314dacf6c1ef5f17ae1
51 changes: 1 addition & 50 deletions src/PatternLab/PatternData.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,55 +233,6 @@ public static function get() {

}


/**
* Compare two sections of data in order to calculate pattern ordering
*/
public static function recursive_sort(array &$data) {
$has_key = FALSE;
foreach ($data as $value) {
if (isset($value['order'])) {
$has_key = TRUE;
break;
}
}

if ($has_key) {
usort($data, [__CLASS__, 'compareData']);
}

foreach ($data as $key => $value) {
if (is_array($value)) {
self::recursive_sort($data[$key]);
}
}

return $data;
}


/**
* Compare two sections of data in order to calculate pattern ordering
*/
public static function compareData($a, $b) {
if (isset($a['order']) && isset($b['order'])){
return ($a['order'] < $b['order']) ? -1 : 1;
} else {
return 0;
}
}


/**
* Recursively sort the global patternData based on the key provided
* ex. $sortedData = PatternData::sortPatternData($data, 'order');
*/
public static function sortPatternData(array $data) {
$result = self::recursive_sort($data);
return $result;
}


/**
* Get the directory separator
*/
Expand All @@ -290,7 +241,7 @@ public static function getDirSep() {
}

/**
* GEt the front meta bits (hidden and noviewall)
* Get the front meta bits (hidden and noviewall)
*/
public static function getFrontMeta() {
return self::$frontMeta;
Expand Down