-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UnexpectedResponseCodeException that bears more information
- Loading branch information
1 parent
fb04ed5
commit c9cbb06
Showing
3 changed files
with
50 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace AsyncConnection\Smtp; | ||
|
||
class UnexpectedResponseCodeException extends \AsyncConnection\AsyncConnectionException | ||
{ | ||
|
||
/** @var int */ | ||
private $actualCode; | ||
|
||
/** @var int[] */ | ||
private $expectedCodes; | ||
|
||
/** | ||
* @param int $actualCode | ||
* @param int[] $expectedCodes | ||
* @param string $errorMessage | ||
* @param string $responseMessage | ||
*/ | ||
public function __construct( | ||
int $actualCode, | ||
array $expectedCodes, | ||
string $errorMessage, | ||
string $responseMessage | ||
) | ||
{ | ||
parent::__construct(sprintf('%s: %s', $errorMessage, $responseMessage)); | ||
$this->actualCode = $actualCode; | ||
$this->expectedCodes = $expectedCodes; | ||
} | ||
|
||
public function getActualCode(): int | ||
{ | ||
return $this->actualCode; | ||
} | ||
|
||
/** | ||
* @return int[] | ||
*/ | ||
public function getExpectedCodes(): array | ||
{ | ||
return $this->expectedCodes; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters