protected function _changeIds($array, $oldId, $newId, $keys) {
        if (!is_array($array)) {
            return $array;
        }

        $matches = array_intersect_key($array, $keys);
        foreach($matches as $key => &$curId) {
            if ($curId == $oldId) {
                $array[$key] = $newId;
            }
        }

        return $array;
    }
protected function _changeIds($array, $oldId, $newId, $keys) {
        if (!is_array($array)) {
            return $array;
        }

        $matches = array_intersect_key($array, $keys);
        foreach($matches as $key => &$curId) {
            if ($curId == $oldId) {
                $array[$key] = $newId;
            }
        }

        return $array;
    }
protected function _changeIds ( $ array , $ oldId , $ newId , $ keys ) { if ( ! is_array ( $ array ) ) { return $ array ; } $ matches = array_intersect_key ( $ array , $ keys ) ; foreach ( $ matches as $ key => & $ curId ) { if ( $ curId == $ oldId ) { $ array [ $ key ] = $ newId ; } } return $ array ; }
Helper function for setcurrentOrganization

Change value to $newId in an array if the key is in the $keys array (as key) and value is $oldId

@param array $array
@param int $oldId
@param int $newId
@param array $keys
@return array
Helper function for setcurrentOrganization