protected function sortByUids($uids, $contents)
    {
        $uids = (array) $uids;

        $orderedUids = [];
        foreach ($uids as $key => $uid) {
            $orderedUids[$uid] = $key;
        }

        $formattedResult = [];
        foreach ($contents as $content) {
            if (isset($orderedUids[$content->getUid()])) {
                $formattedResult[$orderedUids[$content->getUid()]] = $content;
            }
        }

        ksort($formattedResult);

        return $formattedResult;
    }
protected function sortByUids($uids, $contents)
    {
        $uids = (array) $uids;

        $orderedUids = [];
        foreach ($uids as $key => $uid) {
            $orderedUids[$uid] = $key;
        }

        $formattedResult = [];
        foreach ($contents as $content) {
            if (isset($orderedUids[$content->getUid()])) {
                $formattedResult[$orderedUids[$content->getUid()]] = $content;
            }
        }

        ksort($formattedResult);

        return $formattedResult;
    }
protected function sortByUids ( $ uids , $ contents ) { $ uids = ( array ) $ uids ; $ orderedUids = [ ] ; foreach ( $ uids as $ key => $ uid ) { $ orderedUids [ $ uid ] = $ key ; } $ formattedResult = [ ] ; foreach ( $ contents as $ content ) { if ( isset ( $ orderedUids [ $ content -> getUid ( ) ] ) ) { $ formattedResult [ $ orderedUids [ $ content -> getUid ( ) ] ] = $ content ; } } ksort ( $ formattedResult ) ; return $ formattedResult ; }
Keep the order of contents by the list of uids

@param array $uids
@param Paginator $contents

@return null|Paginator
Keep the order of contents by the list of uids