Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

make ApiError json serializable #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ vendor
.php-cs-fixer.cache
.phpunit.result.cache
composer.lock
.idea/
16 changes: 15 additions & 1 deletion lib/Exceptions/ApiError.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace AboutYou\Cloud\AdminApi\Exceptions;

class ApiError
use JsonSerializable;

class ApiError implements JsonSerializable
{
/**
* @var string
Expand Down Expand Up @@ -49,4 +51,16 @@ public function getContext()
{
return $this->context;
}

/**
* @return array
*/
public function jsonSerialize()
{
return [
'errorKey' => $this->errorKey,
'message' => $this->message,
'context' => $this->context,
];
}
}