-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from smsapi/uri-with-port
Uri with port
- Loading branch information
Showing
13 changed files
with
286 additions
and
29 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
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
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,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Smsapi\Client\Infrastructure\HttpClient; | ||
|
||
use Exception; | ||
use Psr\Http\Client\ClientExceptionInterface; | ||
use Psr\Http\Message\RequestInterface; | ||
|
||
/** | ||
* @api | ||
*/ | ||
class ClientException extends Exception implements ClientExceptionInterface | ||
{ | ||
private $request; | ||
|
||
public static function withRequest(string $message, RequestInterface $request): self | ||
{ | ||
$exception = new static($message); | ||
$exception->request = $request; | ||
|
||
return $exception; | ||
} | ||
|
||
public function getRequest(): RequestInterface | ||
{ | ||
return $this->request; | ||
} | ||
} |
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,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Smsapi\Client\Infrastructure\HttpClient; | ||
|
||
use Psr\Http\Client\NetworkExceptionInterface; | ||
|
||
/** | ||
* @api | ||
*/ | ||
class NetworkException extends ClientException implements NetworkExceptionInterface | ||
{ | ||
|
||
} |
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,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Smsapi\Client\Infrastructure\HttpClient; | ||
|
||
use Psr\Http\Client\RequestExceptionInterface; | ||
|
||
/** | ||
* @api | ||
*/ | ||
class RequestException extends ClientException implements RequestExceptionInterface | ||
{ | ||
|
||
} |
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,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Smsapi\Client\Tests\Helper\HttpClient; | ||
|
||
use GuzzleHttp\Psr7\Response; | ||
use Psr\Http\Client\ClientInterface; | ||
use Psr\Http\Message\RequestInterface; | ||
use Psr\Http\Message\ResponseInterface; | ||
|
||
class HttpClientRequestSpy implements ClientInterface | ||
{ | ||
private $lastSentRequest; | ||
|
||
public function sendRequest(RequestInterface $request): ResponseInterface | ||
{ | ||
$this->lastSentRequest = $request; | ||
|
||
return new Response(); | ||
} | ||
|
||
public function getLastSentRequest(): RequestInterface | ||
{ | ||
return $this->lastSentRequest; | ||
} | ||
} |
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
Oops, something went wrong.