Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 496bad2

Browse files
committed
qa: edits to documentation
- Use consistent bullet point formatting. - Use consistent line lengths. - Use consistent casing. - Use consistent whitespace. - Minor grammatical changes and linking.
1 parent ecac451 commit 496bad2

File tree

4 files changed

+31
-27
lines changed

4 files changed

+31
-27
lines changed

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ Versions 0.3.0 and prior were released as "weierophinney/problem-details".
88

99
### Added
1010

11-
- [#51](https://github.com/zendframework/zend-problem-details/pull/51) adds new `problem-details.default_types_map`
12-
config option, that can be used to define custom `type` values based on status codes.
11+
- [#51](https://github.com/zendframework/zend-problem-details/pull/51) adds a new `problem-details.default_types_map` config option, which can be used to define custom `type` values based on status codes.
1312

1413
### Changed
1514

docs/book/default-types.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,50 @@
1-
# Default types
1+
# Default Types
22

3-
When you raise your own exceptions implementing `Zend\ProblemDetails\Exception\ProblemDetailsExceptionInterface` you
4-
will always be in control of all the properties returned as part of the response payload, naming `status`, `type`,
5-
`title`, `detail`, etc.
3+
When you raise your own exceptions implementing `Zend\ProblemDetails\Exception\ProblemDetailsExceptionInterface`
4+
you will always be in control of all the properties returned as part of the
5+
response payload, including the `status`, `type`, `title`, `detail`, etc.
6+
items.
67

7-
However, there are some use cases in which this library will have to infer some of those values.
8+
However, there are some use cases in which this library will have to infer some
9+
of those values.
810

911
The main situations in which this can happen are:
1012

11-
* When an exception not implementing `ProblemDetailsExceptionInterface` is captured by the `ProblemDetailsMiddleware`.
12-
* When the `ProblemDetailsNotFoundHandler` is executed.
13+
- When an exception not implementing `ProblemDetailsExceptionInterface` is
14+
captured by the `ProblemDetailsMiddleware`.
15+
- When the `ProblemDetailsNotFoundHandler` is executed.
1316

14-
In these two cases, the `title` and `type` properties will be inferred from the status code, which will usually be
15-
`500` in the first case and `404` in the second one.
17+
In these two cases, the `title` and `type` properties will be inferred from the
18+
status code, which will usually be `500` in the first case and `404` in the
19+
second one.
1620

17-
> To be more precise, the `ProblemDetailsMiddleware` will use the exception's error code when `debug` is `true`,
18-
> and `500` otherwise.
21+
> To be more precise, the `ProblemDetailsMiddleware` will use the exception's
22+
> error code when `debug` is `true`, and `500` otherwise.
1923
20-
Because of this, in any of those cases, you will end up with values like `https://httpstatus.es/404` or
21-
`https://httpstatus.es/500` for the `type` property.
24+
Because of this, in any of those cases, you will end up with values like
25+
`https://httpstatus.es/404` or `https://httpstatus.es/500` for the `type`
26+
property.
2227

2328
## Configuring custom default types
2429

25-
Since the `type` property will usually be used by API consumers to uniquely identify an error, you might want to be
26-
able to provide your own custom values for the `type` property.
30+
Since the `type` property will usually be used by API consumers to uniquely
31+
identify an error, you might want to be able to provide your own custom values
32+
for the `type` property.
2733

28-
In order to do that, this library lets you configure the default `type` value to be used for every status code
29-
when some of the cases listed above happens.
34+
In order to do that, this library lets you configure the default `type` value to
35+
be used for every status code when some of the cases listed above happens.
3036

3137
```php
3238
return [
33-
3439
'problem-details' => [
3540
'default_types_map' => [
3641
404 => 'https://example.com/problem-details/error/not-found',
3742
500 => 'https://example.com/problem-details/error/internal-server-error',
3843
],
3944
],
40-
4145
];
4246
```
4347

4448
If this configuration is found, it will be consumed by the
45-
[ProblemDetailsResponseFactoryFactory](response.md#problemdetailsresponsefactoryfactory) and your custom values will
46-
be used when the `type` was not explicitly provided.
49+
[ProblemDetailsResponseFactoryFactory](response.md#problemdetailsresponsefactoryfactory)
50+
and your custom values will be used when the `type` was not explicitly provided.

docs/book/response.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,10 @@ This package also provides a factory for generating the
147147
containing a `json_flags` key, and that value is an integer, that value is
148148
provided as the `$jsonFlags` parameter.
149149
- If the service contains a `problem-details` key with an array value
150-
containing a `default_types_map` key, and that value is an array, that value is
151-
provided as the `$defaultTypesMap` parameter.
152-
> More information about defining [default types](default-types.md).
150+
containing a `default_types_map` key, and that value is an array, that
151+
value is provided as the `$defaultTypesMap` parameter; see the
152+
[default types documentation](default-types.md) for details on defining
153+
this map.
153154

154155
If any of the above config values are not present, a `null` value will be
155156
passed, allowing the default value to be used.

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pages:
99
- "Exceptions": exception.md
1010
- "Error Handling Middleware": middleware.md
1111
- "Not Found Handler": not-found-handler.md
12-
- "Default types": default-types.md
12+
- "Default Types": default-types.md
1313
site_name: zend-problem-details
1414
site_description: 'PSR-7 Problem Details for HTTP API responses and middleware'
1515
repo_url: 'https://github.com/zendframework/zend-problem-details'

0 commit comments

Comments
 (0)