-
-
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.
try to make sure we have set content type header
when produceErrorResponse is called before we have init'd our parameters
- Loading branch information
1 parent
9975e13
commit 6066c24
Showing
2 changed files
with
127 additions
and
85 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace LitCal\AnniversaryCalculator\Enums; | ||
|
||
class StatusCode | ||
{ | ||
public const BAD_REQUEST = 400; | ||
public const NOT_FOUND = 404; | ||
public const METHOD_NOT_ALLOWED = 405; | ||
public const NOT_ACCEPTABLE = 406; | ||
public const UNSUPPORTED_MEDIA_TYPE = 415; | ||
public const UNPROCESSABLE_CONTENT = 422; | ||
public const SERVICE_UNAVAILABLE = 503; | ||
private const STATUS_CODES = [ | ||
StatusCode::BAD_REQUEST => " 400 Bad Request", | ||
StatusCode::NOT_FOUND => " 404 Not Found", | ||
StatusCode::METHOD_NOT_ALLOWED => " 405 Method Not Allowed", | ||
StatusCode::NOT_ACCEPTABLE => " 406 Not Acceptable", | ||
StatusCode::UNSUPPORTED_MEDIA_TYPE => " 415 Unsupported Media Type", | ||
StatusCode::UNPROCESSABLE_CONTENT => " 422 Unprocessable Content", | ||
StatusCode::SERVICE_UNAVAILABLE => " 503 Service Unavailable" | ||
]; | ||
public static function toString(int $code): string | ||
{ | ||
return StatusCode::STATUS_CODES[ $code ]; | ||
} | ||
} |