Skip to content

Commit e29d657

Browse files
committed
MessageSentReport always has a request
1 parent 4cefc22 commit e29d657

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/MessageSentReport.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class MessageSentReport implements \JsonSerializable {
2020
protected $success;
2121

2222
/**
23-
* @var RequestInterface | null
23+
* @var RequestInterface
2424
*/
2525
protected $request;
2626

@@ -40,10 +40,10 @@ class MessageSentReport implements \JsonSerializable {
4040
* @param bool $success
4141
* @param string $reason
4242
*/
43-
public function __construct(?RequestInterface $request = null, ?ResponseInterface $response = null, bool $success = true, $reason = 'OK') {
44-
$this->success = $success;
45-
$this->request = $request;
46-
$this->response = $response;
43+
public function __construct(RequestInterface $request, ?ResponseInterface $response = null, bool $success = true, $reason = 'OK') {
44+
$this->request = $request;
45+
$this->response = $response;
46+
$this->success = $success;
4747
$this->reason = $reason;
4848
}
4949

@@ -65,9 +65,9 @@ public function setSuccess(bool $success): MessageSentReport {
6565
}
6666

6767
/**
68-
* @return RequestInterface | null
68+
* @return RequestInterface
6969
*/
70-
public function getRequest(): ?RequestInterface {
70+
public function getRequest(): RequestInterface {
7171
return $this->request;
7272
}
7373

@@ -99,13 +99,9 @@ public function setResponse(ResponseInterface $response): MessageSentReport {
9999
}
100100

101101
/**
102-
* @return string | null
102+
* @return string
103103
*/
104-
public function getEndpoint(): ?string {
105-
if (!$this->request) {
106-
return null;
107-
}
108-
104+
public function getEndpoint(): string {
109105
return $this->request->getUri()->__toString();
110106
}
111107

@@ -145,9 +141,13 @@ public function getRequestPayload(): string {
145141
}
146142

147143
/**
148-
* @return string
144+
* @return string | null
149145
*/
150-
public function getResponseContent(): string {
146+
public function getResponseContent(): ?string {
147+
if (!$this->response) {
148+
return null;
149+
}
150+
151151
return $this->response->getBody()->getContents();
152152
}
153153

0 commit comments

Comments
 (0)