src/nusoap_client.php
function UpdateCookies($cookies)
    {
        if (sizeof($this->cookies) == 0) {
            // no existing cookies: take whatever is new
            if (sizeof($cookies) > 0) {
                $this->debug('Setting new cookie(s)');
                $this->cookies = $cookies;
            }

            return TRUE;
        }
        if (sizeof($cookies) == 0) {
            // no new cookies: keep what we've got
            return TRUE;
        }
        // merge
        foreach ($cookies as $newCookie) {
            if (!is_array($newCookie)) {
                continue;
            }
            if ((!isset($newCookie['name'])) || (!isset($newCookie['value']))) {
                continue;
            }
            $newName = $newCookie['name'];

            $found = FALSE;
            for ($i = 0; $i < count($this->cookies); $i++) {
                $cookie = $this->cookies[$i];
                if (!is_array($cookie)) {
                    continue;
                }
                if (!isset($cookie['name'])) {
                    continue;
                }
                if ($newName != $cookie['name']) {
                    continue;
                }
                $newDomain = isset($newCookie['domain']) ? $newCookie['domain'] : 'NODOMAIN';
                $domain    = isset($cookie['domain']) ? $cookie['domain'] : 'NODOMAIN';
                if ($newDomain != $domain) {
                    continue;
                }
                $newPath = isset($newCookie['path']) ? $newCookie['path'] : 'NOPATH';
                $path    = isset($cookie['path']) ? $cookie['path'] : 'NOPATH';
                if ($newPath != $path) {
                    continue;
                }
                $this->cookies[$i] = $newCookie;
                $found             = TRUE;
                $this->debug('Update cookie ' . $newName . '=' . $newCookie['value']);
                break;
            }
            if (!$found) {
                $this->debug('Add cookie ' . $newName . '=' . $newCookie['value']);
                $this->cookies[] = $newCookie;
            }
        }

        return TRUE;
    }
function UpdateCookies($cookies)
    {
        if (sizeof($this->cookies) == 0) {
            // no existing cookies: take whatever is new
            if (sizeof($cookies) > 0) {
                $this->debug('Setting new cookie(s)');
                $this->cookies = $cookies;
            }

            return TRUE;
        }
        if (sizeof($cookies) == 0) {
            // no new cookies: keep what we've got
            return TRUE;
        }
        // merge
        foreach ($cookies as $newCookie) {
            if (!is_array($newCookie)) {
                continue;
            }
            if ((!isset($newCookie['name'])) || (!isset($newCookie['value']))) {
                continue;
            }
            $newName = $newCookie['name'];

            $found = FALSE;
            for ($i = 0; $i < count($this->cookies); $i++) {
                $cookie = $this->cookies[$i];
                if (!is_array($cookie)) {
                    continue;
                }
                if (!isset($cookie['name'])) {
                    continue;
                }
                if ($newName != $cookie['name']) {
                    continue;
                }
                $newDomain = isset($newCookie['domain']) ? $newCookie['domain'] : 'NODOMAIN';
                $domain    = isset($cookie['domain']) ? $cookie['domain'] : 'NODOMAIN';
                if ($newDomain != $domain) {
                    continue;
                }
                $newPath = isset($newCookie['path']) ? $newCookie['path'] : 'NOPATH';
                $path    = isset($cookie['path']) ? $cookie['path'] : 'NOPATH';
                if ($newPath != $path) {
                    continue;
                }
                $this->cookies[$i] = $newCookie;
                $found             = TRUE;
                $this->debug('Update cookie ' . $newName . '=' . $newCookie['value']);
                break;
            }
            if (!$found) {
                $this->debug('Add cookie ' . $newName . '=' . $newCookie['value']);
                $this->cookies[] = $newCookie;
            }
        }

        return TRUE;
    }
function UpdateCookies ( $ cookies ) { if ( sizeof ( $ this -> cookies ) == 0 ) { // no existing cookies: take whatever is new
 if ( sizeof ( $ cookies ) > 0 ) { $ this -> debug ( 'Setting new cookie(s)' ) ; $ this -> cookies = $ cookies ; } return TRUE ; } if ( sizeof ( $ cookies ) == 0 ) { // no new cookies: keep what we've got
 return TRUE ; } // merge
 foreach ( $ cookies as $ newCookie ) { if ( ! is_array ( $ newCookie ) ) { continue ; } if ( ( ! isset ( $ newCookie [ 'name' ] ) ) || ( ! isset ( $ newCookie [ 'value' ] ) ) ) { continue ; } $ newName = $ newCookie [ 'name' ] ; $ found = FALSE ; for ( $ i = 0 ; $ i < count ( $ this -> cookies ) ; $ i ++ ) { $ cookie = $ this -> cookies [ $ i ] ; if ( ! is_array ( $ cookie ) ) { continue ; } if ( ! isset ( $ cookie [ 'name' ] ) ) { continue ; } if ( $ newName != $ cookie [ 'name' ] ) { continue ; } $ newDomain = isset ( $ newCookie [ 'domain' ] ) ? $ newCookie [ 'domain' ] : 'NODOMAIN' ; $ domain = isset ( $ cookie [ 'domain' ] ) ? $ cookie [ 'domain' ] : 'NODOMAIN' ; if ( $ newDomain != $ domain ) { continue ; } $ newPath = isset ( $ newCookie [ 'path' ] ) ? $ newCookie [ 'path' ] : 'NOPATH' ; $ path = isset ( $ cookie [ 'path' ] ) ? $ cookie [ 'path' ] : 'NOPATH' ; if ( $ newPath != $ path ) { continue ; } $ this -> cookies [ $ i ] = $ newCookie ; $ found = TRUE ; $ this -> debug ( 'Update cookie ' . $ newName . '=' . $ newCookie [ 'value' ] ) ; break ; } if ( ! $ found ) { $ this -> debug ( 'Add cookie ' . $ newName . '=' . $ newCookie [ 'value' ] ) ; $ this -> cookies [ ] = $ newCookie ; } } return TRUE ; }
updates the current cookies with a new set

@param array $cookies new cookies with which to update current ones

@return    boolean always return true
@access    private
updates the current cookies with a new set