-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement multiple stream searches and error response for twitch api …
…error response
- Loading branch information
PZ
committed
Jan 5, 2023
1 parent
ddc22bd
commit 73e330f
Showing
6 changed files
with
106 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Padhie\TwitchApiBundle\Response; | ||
|
||
final class ErrorResponse implements ResponseInterface | ||
{ | ||
private string $error; | ||
private int $status; | ||
private string $message; | ||
|
||
public static function createFromArray(array $data): self | ||
{ | ||
$self = new self(); | ||
|
||
$self->error = $data['error']; | ||
$self->status = $data['status']; | ||
$self->message = $data['message']; | ||
|
||
return $self; | ||
} | ||
|
||
public function jsonSerialize(): array | ||
{ | ||
return [ | ||
'error' => $this->error, | ||
'status' => $this->status, | ||
'message' => $this->message, | ||
]; | ||
} | ||
} |
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