-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
throw exception when response has not the requested language
- Loading branch information
Showing
4 changed files
with
82 additions
and
5 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
src/V2/Localization/Exception/InvalidLanguageException.php
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,47 @@ | ||
<?php | ||
|
||
namespace GW2Treasures\GW2Api\V2\Localization\Exception; | ||
|
||
use GuzzleHttp\Message\ResponseInterface; | ||
use GW2Treasures\GW2Api\Exception\ApiException; | ||
|
||
class InvalidLanguageException extends ApiException { | ||
|
||
/** @var string $requestLanguage */ | ||
protected $requestLanguage; | ||
|
||
/** @var string $responseLanguage */ | ||
protected $responseLanguage; | ||
|
||
/** | ||
* @param string $message | ||
* @param string $requestLanguage | ||
* @param string $responseLanguage | ||
* @param ResponseInterface $response | ||
*/ | ||
public function __construct( $message, $requestLanguage, $responseLanguage, ResponseInterface $response ) { | ||
$this->requestLanguage = $requestLanguage; | ||
$this->responseLanguage = $responseLanguage; | ||
|
||
parent::__construct( $message, $response ); | ||
} | ||
|
||
/** | ||
* Get the requested language. | ||
* | ||
* @return string | ||
*/ | ||
public function getRequestLanguage() { | ||
return $this->requestLanguage; | ||
} | ||
|
||
/** | ||
* Get the language the api responded with. | ||
* | ||
* @return string | ||
*/ | ||
public function getResponseLanguage() { | ||
return $this->responseLanguage; | ||
} | ||
|
||
} |
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