@param $statuscode
@param $remote_app_id
@param $last_response

@throws \Exception
@throws \PropelException
510059
public static function create($statuscode,$remote_app_id, $last_response){

        $aLogs = ApiLogQuery::create()->findByRemoteAppId($remote_app_id);
        foreach($aLogs as $oLog){
            $oLog->delete();
        }

        $oApiLog = new ApiLog();
        $oApiLog->setRemoteAppId($remote_app_id);
        $oApiLog->setStatuscode($statuscode);
        $oApiLog->setLastResponse($last_response);
        $dt = new \DateTime();
        $oApiLog->setDtCall($dt);
        $oApiLog->save();
    }
765274
public void cancel(final String appName, final String id) throws Exception {
        long expiryTime = System.currentTimeMillis() + maxProcessingDelayMs;
        batchingDispatcher.process(
                taskId("cancel", appName, id),
                new InstanceReplicationTask(targetHost, Action.Cancel, appName, id) {
                    @Override
                    public EurekaHttpResponse<Void> execute() {
                        return replicationClient.cancel(appName, id);
                    }

                    @Override
                    public void handleFailure(int statusCode, Object responseEntity) throws Throwable {
                        super.handleFailure(statusCode, responseEntity);
                        if (statusCode == 404) {
                            logger.warn("{}: missing entry.", getTaskName());
                        }
                    }
                },
                expiryTime
        );
    }
186400
protected function readResponse($statusCode, $responseBody)
    {
        $unserialized = null;

        switch ($statusCode) {
            case 200:
            case 201:
                $unserialized = $this->unserialize($responseBody);
                break;
            case 400:
                $exception = null;
                $response  = json_decode($responseBody);

                foreach ($response as $error) {
                    $cieloError = new CieloError($error->Message, $error->Code);
                    $exception  = new CieloRequestException('Request Error', $statusCode, $exception);
                    $exception->setCieloError($cieloError);
                }

                throw $exception;
            case 404:
                throw new CieloRequestException('Resource not found', 404, null);
            default:
                throw new CieloRequestException('Unknown status', $statusCode);
        }

        return $unserialized;
    }
1259118
public function setStatusCode($statusCode, $statusText = null)
    {
        if ($statusText === null
            && array_key_exists((int) $statusCode, $this->statusTexts)
        ) {
            $statusText = $this->statusTexts[$statusCode];
        }

        $this->statusCode = (int) $statusCode;
        $this->statusText = (string) $statusText;
    }
626127
public function setStatusHelper($statusCode)
    {
        if (null !== $ordeStatus = OrderStatusQuery::create()->findOneByCode($statusCode)) {
            $this->setOrderStatus($ordeStatus)->save();
        }
    }
618965
public void redirect(String location, int statusCode) {
        checkCommitted();
        finalizeResponse();

        status(statusCode);
        header(HttpConstants.Header.LOCATION, location);
        header(HttpConstants.Header.CONNECTION, "close");
        try {
            httpServletResponse.sendError(statusCode);
        } catch (IOException e) {
            throw new PippoRuntimeException(e);
        }
    }
1102046
protected function redirect($url, $statusCode = 302)
    {
        $response = new RedirectResponse($url, $statusCode);
        $this->getServiceLocator()->set('Response', $response);

        return $response;
    }
1279160
public function sendApiRestEncode($code=200, $data = NULL, $options= 0, $contentType='application/json'){        
        $this->sendApiRest($code, json_encode($data, $options), $contentType);
    }
1203361
public function statusCode($code = null, $reasonPhrase = null)
    {
        if (func_num_args() < 1 || empty($code)) {
            return $this->response->getStatusCode();
        }
        $this->response = $this->response->withStatus($code, $reasonPhrase);
        return $this;
    }
848689
public function setStatusCode(int $statusCode): self
    {
        if (!array_key_exists($statusCode, Response::$statusTexts)) {
            $this->internalServerError('Invalid status code in ' . __METHOD__, Response::$statusTexts);
        }

        $this->statusCode = $statusCode;

        return $this;
    }
948836
public function redirect($uri, int $statusCode = 302): self
    {
        $this->headers->location($uri);
        return $this->fixateCode($statusCode);
    }
1371727
public void close(int statusCode, HandshakeResponse errResponse) {
        log.warn("Closing connection with status: {}", statusCode);
        // remove handshake flag
        session.removeAttribute(Constants.HANDSHAKE_COMPLETE);
        // clear the delay queue
        queue.clear();
        // send http error response
        session.write(errResponse);
        // whether to attempt a nice close or a forceful one
        if (WebSocketTransport.isNiceClose()) {
            // now send close packet with error code
            IoBuffer buf = IoBuffer.allocate(16);
            buf.setAutoExpand(true);
            // all errors except 403 will use 1002
            buf.putUnsigned((short) statusCode);
            try {
                if (statusCode == 1008) {
                    // if its a 403 forbidden
                    buf.put("Policy Violation".getBytes("UTF8"));
                } else {
                    buf.put("Protocol error".getBytes("UTF8"));
                }
            } catch (Exception e) {
                // shouldnt be any text encoding issues...
            }
            buf.flip();
            byte[] errBytes = new byte[buf.remaining()];
            buf.get(errBytes);
            // construct the packet
            Packet packet = Packet.build(errBytes, MessageType.CLOSE);
            WriteFuture writeFuture = session.write(packet);
            writeFuture.addListener(new IoFutureListener<WriteFuture>() {

                @Override
                public void operationComplete(WriteFuture future) {
                    if (future.isWritten()) {
                        log.debug("Close message written");
                        // only set on success for now to skip boolean check later
                        session.setAttribute(Constants.STATUS_CLOSE_WRITTEN, Boolean.TRUE);
                    }
                    future.removeListener(this);
                }

            });
            // adjust close routine to allow for flushing
            CloseFuture closeFuture = session.closeOnFlush();
            closeFuture.addListener(new IoFutureListener<CloseFuture>() {

                public void operationComplete(CloseFuture future) {
                    if (future.isClosed()) {
                        log.debug("Connection is closed");
                    } else {
                        log.debug("Connection is not yet closed");
                    }
                    future.removeListener(this);
                }

            });
        } else {
            // force close
            CloseFuture closeFuture = session.closeNow();
            closeFuture.addListener(new IoFutureListener<CloseFuture>() {

                public void operationComplete(CloseFuture future) {
                    if (future.isClosed()) {
                        log.debug("Connection is closed");
                    } else {
                        log.debug("Connection is not yet closed");
                    }
                    future.removeListener(this);
                }

            });
        }
        log.debug("Close complete");
    }
1289552
public function success(int $statusCode, string $message, $data = null): JsonResponse
    {

        $this->setStatusCode($statusCode);

        $this->setMessage($message);

        $this->setData($data);


        $content['message'] = $this->getMessage();


        if (null !== $this->getCode()) {
            $content['code'] = $this->getCode();
        }


        $content['status_code'] = $this->getStatusCode();


        if (null !== $this->getData() && $this->getErrors() !== $this->getData()) {
            $content['data'] = $this->getData();
        }

        if (null !== $this->getErrors()) {
            $content['errors'] = $this->getErrors();
        }

        $content += $this->Hypermedia;

        return new JsonResponse($content, $this->getHttpStatusCode() ?: $this->getStatusCode());
    }
572419
public function errorResponse($connection, $statusCode, $body=null,  $reason=null, array $headers=[])
    {
        $res= new Response($statusCode, $body);
        if(!$reason) {
            $res->statusReason = \yii\web\Response::$httpStatuses[$statusCode];
        }
        
        if($body === null){
            $res->body = \yii\web\Response::$httpStatuses[$statusCode];
            
            $errpage = $this->getErrorPageFile($res->statusCode);
            
            if($errpage) {
                ob_start();
                include $errpage;
                $res->body = ob_get_clean();
            }
        }
        
        foreach($headers as $name => $value){
            $res->headers->add($name, $value);
        }
        
        $res->headers->remove('Content-Length');
        $res->headers->set('Connection', 'Close');
        
        $connection->close($res);
    }
96806
public void addStatusMapping(String statusCode, Integer httpStatus) {
		Assert.notNull(statusCode, "StatusCode must not be null");
		Assert.notNull(httpStatus, "HttpStatus must not be null");
		this.statusMapping.put(statusCode, httpStatus);
	}
1188419
protected function validateStatusCode($statusCode) : void
	{
		if (! \is_int($statusCode))
		{
			throw new \InvalidArgumentException('HTTP status-code must be an integer');
		}
		else if (! ($statusCode >= 100 && $statusCode <= 599))
		{
			throw new \InvalidArgumentException(\sprintf('The given status-code "%d" is not valid', $statusCode));
		}
	}
159773
protected function respond($response, $request, $options, $statusCode)
    {
        if (array_key_exists('webhooks', $response)) {
            $results = [];
            foreach ($response['webhooks'] as $result) {
                $results[] = $this->mapResponse($result, $statusCode);
            }

            return $results;
        }

        // IPN response
        if (in_array(Arr::get($response, 'body'), ['VERIFIED', 'INVALID'])) {
            $response = array_merge($request, $response);
        }
        // charge request
        elseif (array_key_exists('continue_url', $options)) {
            $response['continue_url'] = $options['continue_url'];
            $response['is_redirect'] = true;
        }

        return $this->mapResponse($response, $statusCode);
    }