<?php
 declare(strict_types=1); namespace Square\Exceptions; use Square\Http\HttpResponse; use Square\Http\HttpRequest; class ApiException extends \Exception implements Exception { private $request; private $response; public function __construct(string $reason, HttpRequest $request, ?HttpResponse $response = null) { parent::__construct($reason, \is_null($response) ? 0 : $response->getStatusCode()); $this->request = $request; $this->response = $response; } public function getHttpRequest(): HttpRequest { return $this->request; } public function getHttpResponse(): ?HttpResponse { return $this->response; } public function hasResponse(): bool { return !\is_null($this->response); } } 