public static function reorder(array $data, array $order, $throwExceptionIfKeyNotFound = false, $throwExceptionIfExtraData = false) {
        $result = array();
        foreach($order as $orderedKey) {
            if (array_key_exists($orderedKey, $data)) {
                $result[$orderedKey] = $data[$orderedKey];
                unset($data[$orderedKey]);
            } elseif ($throwExceptionIfKeyNotFound) {
                throw new KeyNotFoundException("Key '".$orderedKey."' not found in data.");
            }
        }
        if (empty($data)) {
            return $result;
        }
        if ($throwExceptionIfExtraData) {
            throw new ExtraDataException("Extra data found.");
        }
        foreach ($data as $key => $value) {
            $result[$key] = $value;
        }
        return $result;
    }
public static function reorder(array $data, array $order, $throwExceptionIfKeyNotFound = false, $throwExceptionIfExtraData = false) {
        $result = array();
        foreach($order as $orderedKey) {
            if (array_key_exists($orderedKey, $data)) {
                $result[$orderedKey] = $data[$orderedKey];
                unset($data[$orderedKey]);
            } elseif ($throwExceptionIfKeyNotFound) {
                throw new KeyNotFoundException("Key '".$orderedKey."' not found in data.");
            }
        }
        if (empty($data)) {
            return $result;
        }
        if ($throwExceptionIfExtraData) {
            throw new ExtraDataException("Extra data found.");
        }
        foreach ($data as $key => $value) {
            $result[$key] = $value;
        }
        return $result;
    }
public static function reorder ( array $ data , array $ order , $ throwExceptionIfKeyNotFound = false , $ throwExceptionIfExtraData = false ) { $ result = array ( ) ; foreach ( $ order as $ orderedKey ) { if ( array_key_exists ( $ orderedKey , $ data ) ) { $ result [ $ orderedKey ] = $ data [ $ orderedKey ] ; unset ( $ data [ $ orderedKey ] ) ; } elseif ( $ throwExceptionIfKeyNotFound ) { throw new KeyNotFoundException ( "Key '" . $ orderedKey . "' not found in data." ) ; } } if ( empty ( $ data ) ) { return $ result ; } if ( $ throwExceptionIfExtraData ) { throw new ExtraDataException ( "Extra data found." ) ; } foreach ( $ data as $ key => $ value ) { $ result [ $ key ] = $ value ; } return $ result ; }
Orders data based on order of values in order array

@param array $data
@param array $order
@param bool $throwExceptionIfKeyNotFound
@param bool $throwExceptionIfExtraData
@return array
@throws \Subscribo\DependencyResolver\KeyNotFoundException may be thrown, if key is not found in data
@throws \Subscribo\DependencyResolver\ExtraDataException may be thrown, if data is found, which did not had their counterpart in order parameter
Orders data based on order of values in order array