Skip to content

Commit 268a609

Browse files
committed
Extract urls to methods
1 parent 087c88f commit 268a609

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

src/Context/Services/MailTrap.php

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ protected function fetchInbox($inboxId = null)
6060
$this->applyMailTrapConfiguration($inboxId);
6161
}
6262

63-
return $this->requestClient()->get(
64-
"/api/v1/inboxes/{$this->mailTrapInboxId}/messages"
65-
)->json();
63+
return $this->requestClient()
64+
->get($this->getMailTrapMessagesUrl())
65+
->json();
6666
}
6767

6868
/**
@@ -73,9 +73,27 @@ protected function fetchInbox($inboxId = null)
7373
*/
7474
protected function emptyInbox()
7575
{
76-
$this->requestClient()->patch(
77-
"/api/v1/inboxes/{$this->mailTrapInboxId}/clean", ['future' => true]
78-
);
76+
$this->requestClient()->patch($this->getMailTrapCleanUrl(), ['future' => true]);
77+
}
78+
79+
/**
80+
* Get the MailTrap messages endpoint.
81+
*
82+
* @return string
83+
*/
84+
protected function getMailTrapMessagesUrl()
85+
{
86+
return "/api/v1/inboxes/{$this->mailTrapInboxId}/messages";
87+
}
88+
89+
/**
90+
* Get the MailTrap "empty inbox" endpoint.
91+
*
92+
* @return string
93+
*/
94+
protected function getMailTrapCleanUrl()
95+
{
96+
return "/api/v1/inboxes/{$this->mailTrapInboxId}/clean";
7997
}
8098

8199
/**

0 commit comments

Comments
 (0)