New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ErrorData and HeaderRenderer classes #26
Conversation
devanych
commented
Feb 17, 2021
Q | A |
---|---|
Is bugfix? | ❌ |
New feature? | ✔️ |
Breaks BC? | ✔️ |
Fixed issues | #12, #13 |
src/ErrorData.php
Outdated
* | ||
* @return ResponseInterface The response with error data. | ||
*/ | ||
public function setToResponse(ResponseInterface $response): ResponseInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public function setToResponse(ResponseInterface $response): ResponseInterface | |
public function addToResponse(ResponseInterface $response): ResponseInterface |
That's how it's usually named.
src/ErrorData.php
Outdated
use Psr\Http\Message\ResponseInterface; | ||
|
||
/** | ||
* ErrorData stores content and headers that are suitable for displaying. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* ErrorData stores content and headers that are suitable for displaying. | |
* ErrorData stores content and headers that are suitable for adding to response. |
src/ErrorData.php
Outdated
private string $content; | ||
|
||
/** | ||
* @var array<string, string|string[]> The headers of error data to add to the response. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @var array<string, string|string[]> The headers of error data to add to the response. | |
* @var array<string, string|string[]> The headers to add to the response. |
src/ErrorData.php
Outdated
/** | ||
* @var string The content of error data. | ||
*/ | ||
private string $content; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** | |
* @var string The content of error data. | |
*/ | |
private string $content; | |
/** | |
* @var string The content to use as response body. | |
*/ | |
private string $content; |
src/ErrorData.php
Outdated
* @param string $content The content of error data. | ||
* @param array<string, string|string[]> $headers The headers of error data to add to the response. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param string $content The content of error data. | |
* @param array<string, string|string[]> $headers The headers of error data to add to the response. | |
* @param string $content The content to use as response body. | |
* @param array<string, string|string[]> $headers The headers to add to the response. |
src/Middleware/ErrorCatcher.php
Outdated
return $new; | ||
} | ||
|
||
/** | ||
* @param string[] $mimeTypes MIME types or, if not specified, all will be removed. | ||
* @param string[] $contentTypes MIME types or, if not specified, all will be removed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param string[] $contentTypes MIME types or, if not specified, all will be removed. | |
* @param string[] $contentTypes MIME types to remove associated renderers for. If not specified, all renderers will be removed. |
src/ThrowableRendererInterface.php
Outdated
@@ -8,27 +8,29 @@ | |||
use Throwable; | |||
|
|||
/** | |||
* ThrowableRendererInterface converts throwable into its string representation | |||
* ThrowableRendererInterface converts throwable into error data suitable for displaying. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* ThrowableRendererInterface converts throwable into error data suitable for displaying. | |
* ThrowableRendererInterface converts throwable into error data suitable for adding it to response. |
👍 |