protected function getAllMotifs(bool $deepSort = false) : array
{
$allMotifs = [];
$cabins = $this->getCabinNamespaces();
foreach ($cabins as $cabinName) {
$motifs = \Airship\loadJSON(ROOT . '/Cabin/' . $cabinName . '/config/motifs.json');
foreach ($motifs as $motif => $config) {
if (!\array_key_exists($motif, $allMotifs)) {
$allMotifs[$motif] = $config;
$allMotifs[$motif]['link'] = $motif;
}
}
}
if ($deepSort) {
\usort($allMotifs, function (array $a, array $b) : int {
if ($a['supplier'] === $b['supplier']) {
return (int) ($a['name'] <=> $b['name']);
}
return (int) ($a['supplier'] <=> $b['supplier']);
});
} else {
\ksort($allMotifs);
}
return $allMotifs;
}