Add psalm to level 3 and clean up more code

This commit is contained in:
2021-10-21 14:57:29 +09:00
parent d0b676f8ce
commit 192e4e54e1
8 changed files with 100 additions and 92 deletions

View File

@@ -2,7 +2,6 @@
namespace gullevek\AmazonIncentives\Response;
use gullevek\AmazonIncentives\Exceptions\AmazonErrors;
use gullevek\AmazonIncentives\Debug\AmazonDebug;
class CancelResponse
@@ -12,25 +11,25 @@ class CancelResponse
*
* @var string
*/
protected $id;
protected $id = '';
/**
* Amazon Gift Card creationRequestId
*
* @var string
*/
protected $creation_request_id;
protected $creation_request_id = '';
/**
* Amazon Gift Card status
*
* @var string
*/
protected $status;
protected $status = '';
/**
* Amazon Gift Card Raw JSON
*
* @var array<mixed>
*/
protected $raw_json;
protected $raw_json = [];
/**
* Response constructor.
@@ -88,15 +87,6 @@ class CancelResponse
*/
public function parseJsonResponse(array $json_response): self
{
if (!is_array($json_response)) {
throw AmazonErrors::getError(
'FAILURE',
'E001',
'NonScalarValue',
'Response must be a scalar value',
0
);
}
if (array_key_exists('gcId', $json_response)) {
$this->id = $json_response['gcId'];
}