Get the response code.

@throws ehough_shortstop_api_exception_RuntimeException If something goes wrong.

@return int the HTTP response code.
770701
protected function getResponseCode()
    {
        $pieces = explode(' ', $this->_statusLine);

        if (count($pieces) < 2) {

            throw new ehough_shortstop_api_exception_RuntimeException('Invalid status line: ' . $this->_statusLine);
        }

        $code = $pieces[1];

        return intval($code);
    }
790176
public function getStatus()
    {
        $request = $this->apiRequestFactory->createRequest('GET', $this->getBaseUri() . '/status/CLEAN');
        $response = $this->httpClient->sendRequest($request);

        return $response->getStatusCode() === 200;
    }
694110
public function getMessage()
	{
		$code = $this->getCode();

		if (!array_key_exists($code, $this->_messageMap))
			throw new \Ergo\Routing\Exception("Unknown HTTP status code: $code");

		return $this->_messageMap[$code];
	}
509480
public function getResponse()
    {
        if (is_null($this->response)) {
            $this->response = $this->getRunner()->run();
        }
        return $this->response;
    }
743593
public function get()
    {
        if (is_null($this->fromField)) {
            throw new \RuntimeException(
                'The HTTP field must be provided to the builder.'
            );
        }

        return new Preference(
            $this->variant,
            $this->getQualityFactor(),
            $this->getPrecedence()
        );
    }
409492
public function getCode()
    {
        return join(' ', array(
            $this->getResponseCode(),
            $this->getResponseText(),
            '(' . $this->getHttpResponseCode(),
            $this->getHttpResponseCodeText() . ')',
        ));
    }
1369050
public function postBatch()
    {
        $fp = fsockopen($this->hostname, $this->port, $errno, $errstr, 30);

        if (FALSE === $fp) {
            throw new \RuntimeException($errstr, $errno);
        }

        for ($i = 0, $c = count($this->buffer); $i < $c; $i++) {

            $message = $this->buffer[$i];

            $request = "POST /inputs/" . $this->input->getKey() . " HTTP/1.1\r\n";
            $request .= "Host: " . ClientInterface::LOGGLY_HOST . "\r\n";
            $request .= "User-Agent: " . ClientInterface::USER_AGENT . "\r\n";
            $request .= "Content-Type: " . $this->getContentType() . "\r\n";
            $request .= "Content-Length: " . strlen($message) . "\r\n";

            // Add Connection: Close header on the last request.
            $request .= $i === $c - 1 ? "Connection: Close\r\n\r\n" : "\r\n";

            $request .= $message;
            $request .= $i === $c - 1 ? "" : "\r\n";

            fwrite($fp, $request);
        }

        fclose($fp);

        return TRUE;
    }
770566
public function GetCode () {
		if ($this->code === NULL) {
			$phpCode = http_response_code();
			$this->code = $phpCode === FALSE ? static::OK : $phpCode;
		}
		return $this->code;
	}
459430
protected function fetchControllerSuffix()
	{
		// Validate that we have a map to handle the given HTTP method.
		if (!isset($this->suffixMap[$this->input->getMethod()]))
		{
			throw new \RuntimeException(sprintf('Unable to support the HTTP method `%s`.', $this->input->getMethod()), 404);
		}

		// Check if request method is POST
		if ($this->methodInPostRequest == true && strcmp(strtoupper($this->input->server->getMethod()), 'POST') === 0)
		{
			// Get the method from input
			$postMethod = $this->input->get->getWord('_method');

			// Validate that we have a map to handle the given HTTP method from input
			if ($postMethod && isset($this->suffixMap[strtoupper($postMethod)]))
			{
				return ucfirst($this->suffixMap[strtoupper($postMethod)]);
			}
		}

		return ucfirst($this->suffixMap[$this->input->getMethod()]);
	}
856023
public function isSuccess()
    {
        $statuscode = $this->response->getStatusCode();

        if(!in_array($statuscode, [200, 204], true))
        {
            throw new Exception('HTTP Code ' . $statuscode . ' ' . $this->response->getBody());
        }

        return true;
    }
106641
public function getResponseStatusCode ()
    {
        if (!$this->_sent) {
            throw new CAS_OutOfSequenceException(
                'Request has not been sent yet. Cannot '.__METHOD__
            );
        }

        if (!preg_match(
            '/HTTP\/[0-9.]+\s+([0-9]+)\s*(.*)/',
            $this->_responseHeaders[0], $matches
        )
        ) {
            throw new CAS_Request_Exception(
                'Bad response, no status code was found in the first line.'
            );
        }

        return intval($matches[1]);
    }
684382
public function getBody()
    {
        if ($this->isAbstract() === true) {
            throw new RuntimeException('Can not get body of an abstract method');
        }

        $fileName = $this->getDeclaringClass()->getFileName();
        if ($fileName === false) {
            throw new RuntimeException('Can not get body of a method belonging to an internal class.');
        }

        $lines = file($fileName, FILE_IGNORE_NEW_LINES);
        $lines = array_slice($lines, $this->getStartLine() - 1, ($this->getEndLine() - $this->getStartLine() + 1),
            true);
        $lines = implode("\n", $lines);

        $firstBracketPos = strpos($lines, '{');
        $lastBracketPost = strrpos($lines, '}');
        $body = substr($lines, $firstBracketPos + 1, $lastBracketPost - $firstBracketPos - 1);

        return trim(rtrim($body), "\n\r");
    }
122443
public function getResponseCode()
    {
        $code = 0;

        $dom = $this->getDOMDocument();
        $xpath = new DOMXPath($dom);
        if (($codeAttribute = $xpath->query('/response/@code')->item(0)) instanceof DOMAttr) {
            $code = intval($codeAttribute->nodeValue);
        }

        return $code;
    }
1231303
public function getReasonCode()
    {
        $code = null;

        if (isset($this->data->transactionResponse->messages)) {
            // In case of a successful transaction, a "messages" element is present
            $code = intval((string)$this->data->transactionResponse->messages->message->code);
        } elseif (isset($this->data->transactionResponse->errors)) {
            // In case of an unsuccessful transaction, an "errors" element is present
            $code = intval((string)$this->data->transactionResponse->errors->error->errorCode);
        } elseif (isset($this->data->messages->message)) {
            // In case of invalid request, the top-level message provides details.
            $code = (string)$this->data->messages->message->code;
        }

        return $code;
    }
925059
public function getResponse()
    {
        $this->execute();
        
        switch ($this->def['dataType']) {
            case 'array':
                $result = static::toArray();
                break;
            case 'object':
            case 'json':
                $result = static::toJson();
                break;
            default:
                $result = $this->getErrorString() ? : $this->responseText;
        }
        
        return $result;
    }
521459
public function getApi()
    {
        if ($this->app['debug']){
            $exceptionLogStr = 
                'Ext.direct.Manager.on("exception", function(error){console.error(Ext.util.Format.format("Remote Call: {0}.{1}\n{2}", error.action, error.method, error.message, error.where)); return false;});';            
        }else {
            $exceptionLogStr = 
                sprintf('Ext.direct.Manager.on("exception", function(error){alert("%s");});', $this->app['direct.exception.message']);
        }
        
        $apiStr = sprintf("Ext.Direct.addProvider(%s);\n%s", $this, $exceptionLogStr);
        
        // force convertion of api to string
        $response = new Response($apiStr);
        
        // set the response header
        $response->headers->set('Content-Type', 'text/javascript');
        
        return $response;
    }
415780
private function getAuthCode()
    {
        $amount = intval($this->parameters['amount']);
        if (!$this->sandbox) {
            $url = $this->endpoint . "/Auth/{$this->parameters['custom']}/{$this->parameters['transactionId']}/{$amount}";
            $url_redirect = $this->endpoint_redirect;
        } else {
            $url = $this->sandbox_endpoint . "/Auth/{$this->options['app_key']}/{$this->parameters['transactionId']}/{$amount}";
            $url_redirect = $this->sandbox_endpoint_redirect;
        }
        $response = $this->xml2array($this->curl_request($url));
        $output = explode('|', $response['0']);
        if ($output['0'] != 1) {
            throw new \Exception($output['1']);
        }

        $this->transactionReference = $output['2'];
        $this->auth_code = $output['3'];
        $this->redirect = $url_redirect . '?AuthCode=' . $this->auth_code;
    }