src/Tomahawk/Asset/AssetManager.php
protected function arrange(array $assets)
    {
        list($original, $sorted) = array($assets, []);

        while (count($assets) > 0) {
            foreach ($assets as $asset => $value) {
                $this->evaluateAsset($asset, $value, $original, $sorted, $assets);
            }
        }

        return $sorted;
    }
protected function arrange(array $assets)
    {
        list($original, $sorted) = array($assets, []);

        while (count($assets) > 0) {
            foreach ($assets as $asset => $value) {
                $this->evaluateAsset($asset, $value, $original, $sorted, $assets);
            }
        }

        return $sorted;
    }
Sort and retrieve assets based on their dependencies

@param   array  $assets
@return  array