protected function parseResponse($valid, $later = false)
    {
        $this->code      = -1;
        $this->arguments = array();

        if ($later) {
            $this->pipelined_commands++;
            return true;
        }

        for ($i = 0; $i <= $this->pipelined_commands; $i++) {
            while ($line = $this->socket->readLine()) {
                $this->debug("Recv: $line");

                /* If we receive an empty line, the connection was closed. */
                if (empty($line)) {
                    $this->disconnect();
                    return PEAR::raiseError('Connection was closed');
                }

                /* Read the code and store the rest in the arguments array. */
                $code = substr($line, 0, 3);
                $this->arguments[] = trim(substr($line, 4));

                /* Check the syntax of the response code. */
                if (is_numeric($code)) {
                    $this->code = (int)$code;
                } else {
                    $this->code = -1;
                    break;
                }

                /* If this is not a multiline response, we're done. */
                if (substr($line, 3, 1) != '-') {
                    break;
                }
            }
        }

        $this->pipelined_commands = 0;

        /* Compare the server's response code with the valid code/codes. */
        if (is_int($valid) && ($this->code === $valid)) {
            return true;
        } elseif (is_array($valid) && in_array($this->code, $valid, true)) {
            return true;
        }

        return PEAR::raiseError('Invalid response code received from server', $this->code);
    }
protected function parseResponse($valid, $later = false)
    {
        $this->code      = -1;
        $this->arguments = array();

        if ($later) {
            $this->pipelined_commands++;
            return true;
        }

        for ($i = 0; $i <= $this->pipelined_commands; $i++) {
            while ($line = $this->socket->readLine()) {
                $this->debug("Recv: $line");

                /* If we receive an empty line, the connection was closed. */
                if (empty($line)) {
                    $this->disconnect();
                    return PEAR::raiseError('Connection was closed');
                }

                /* Read the code and store the rest in the arguments array. */
                $code = substr($line, 0, 3);
                $this->arguments[] = trim(substr($line, 4));

                /* Check the syntax of the response code. */
                if (is_numeric($code)) {
                    $this->code = (int)$code;
                } else {
                    $this->code = -1;
                    break;
                }

                /* If this is not a multiline response, we're done. */
                if (substr($line, 3, 1) != '-') {
                    break;
                }
            }
        }

        $this->pipelined_commands = 0;

        /* Compare the server's response code with the valid code/codes. */
        if (is_int($valid) && ($this->code === $valid)) {
            return true;
        } elseif (is_array($valid) && in_array($this->code, $valid, true)) {
            return true;
        }

        return PEAR::raiseError('Invalid response code received from server', $this->code);
    }
protected function parseResponse ( $ valid , $ later = false ) { $ this -> code = - 1 ; $ this -> arguments = array ( ) ; if ( $ later ) { $ this -> pipelined_commands ++ ; return true ; } for ( $ i = 0 ; $ i <= $ this -> pipelined_commands ; $ i ++ ) { while ( $ line = $ this -> socket -> readLine ( ) ) { $ this -> debug ( "Recv: $line" ) ; /* If we receive an empty line, the connection was closed. */ if ( empty ( $ line ) ) { $ this -> disconnect ( ) ; return PEAR :: raiseError ( 'Connection was closed' ) ; } /* Read the code and store the rest in the arguments array. */ $ code = substr ( $ line , 0 , 3 ) ; $ this -> arguments [ ] = trim ( substr ( $ line , 4 ) ) ; /* Check the syntax of the response code. */ if ( is_numeric ( $ code ) ) { $ this -> code = ( int ) $ code ; } else { $ this -> code = - 1 ; break ; } /* If this is not a multiline response, we're done. */ if ( substr ( $ line , 3 , 1 ) != '-' ) { break ; } } } $ this -> pipelined_commands = 0 ; /* Compare the server's response code with the valid code/codes. */ if ( is_int ( $ valid ) && ( $ this -> code === $ valid ) ) { return true ; } elseif ( is_array ( $ valid ) && in_array ( $ this -> code , $ valid , true ) ) { return true ; } return PEAR :: raiseError ( 'Invalid response code received from server' , $ this -> code ) ; }
Read a reply from the SMTP server.  The reply consists of a response
code and a response message.

@param mixed $valid The set of valid response codes.  These
may be specified as an array of integer
values or as a single integer value.
@param bool  $later Do not parse the response now, but wait
until the last command in the pipelined
command group

@return mixed True if the server returned a valid response code or
a PEAR_Error object is an error condition is reached.

@since 1.1.0

@see getResponse
Read a reply from the SMTP server . The reply consists of a response code and a response message .