Swift_Transport_AbstractSmtpTransport::_assertResponseCode PHP Method

_assertResponseCode() protected method

Throws an Exception if a response code is incorrect
protected _assertResponseCode ( $response, $wanted )
    protected function _assertResponseCode($response, $wanted)
    {
        list($code) = sscanf($response, '%3d');
        $valid = empty($wanted) || in_array($code, $wanted);
        if ($evt = $this->_eventDispatcher->createResponseEvent($this, $response, $valid)) {
            $this->_eventDispatcher->dispatchEvent($evt, 'responseReceived');
        }
        if (!$valid) {
            $this->_throwException(new Swift_TransportException('Expected response code ' . implode('/', $wanted) . ' but got code ' . '"' . $code . '", with message "' . $response . '"', $code));
        }
    }