src/Common/Internal/Utilities.php
public static function orderArray($array, $order)
    {
        $ordered = [];

        foreach ($order as $key) {
            if (array_key_exists($key, $array)) {
                $ordered[$key] = $array[$key];
            }
        }

        return $ordered;
    }
public static function orderArray($array, $order)
    {
        $ordered = [];

        foreach ($order as $key) {
            if (array_key_exists($key, $array)) {
                $ordered[$key] = $array[$key];
            }
        }

        return $ordered;
    }
public static function orderArray ( $ array , $ order ) { $ ordered = [ ] ; foreach ( $ order as $ key ) { if ( array_key_exists ( $ key , $ array ) ) { $ ordered [ $ key ] = $ array [ $ key ] ; } } return $ ordered ; }
Sorts an array based on given keys order.

@param array $array The array to sort
@param array $order The keys order array

@return array
Sorts an array based on given keys order .