protected function sort(array $assets)
    {
        array_walk(
            $assets,
            function (&$v, $k) {
                /** @var AssetInterface $v */
                $v = [$v->getPriority(), $k, $v];
            }
        );

        sort($assets);

        array_walk(
            $assets,
            function (&$v) {
                $v = $v[2];
            }
        );

        return $assets;
    }