Skip to content

Commit 6c8d73f

Browse files
committed
Tidy documentation
1 parent b8cce8a commit 6c8d73f

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

docs/Responders.md

+22-17
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Responders
22

3-
A responder takes a request and returns a response. It's a simple concept that can be implemented in many ways, of
4-
which this package only provides the foundation.
3+
A responder takes a request and returns a response.
4+
It is a simple concept that can be implemented in many ways,
5+
of which this package only provides the foundation.
56

6-
This package only provides an implementation that delegates the response to a matching responder found by a provider.
7+
This package only provides an implementation that delegates the response to a matching responder
8+
found by a provider.
79
The package [ICanBoogie/Routing][] provides more exciting implementations.
810

911
```php
@@ -22,10 +24,10 @@ $response = $responder->respond($request);
2224

2325
[WithRecovery][] decorates another responder to provide an exception recovery mechanism.
2426

25-
The exception thrown by the responder is caught and a [RecoverEvent][] is emitted. Third parties can
26-
use that event to provide a response or replace the exception.
27+
The exception thrown by the responder is caught, and a [RecoverEvent][] is emitted.
28+
Third parties can use that event to provide a response or replace the exception.
2729

28-
The following example demonstrate how to decorate a responder:
30+
The following example demonstrates how to decorate a responder:
2931

3032
```php
3133
<?php
@@ -37,7 +39,7 @@ namespace ICanBoogie\HTTP;
3739
$responder_with_recovery = new Responder\WithRecovery($responder);
3840
```
3941

40-
The following example demonstrate how to recover [NotFound][] exceptions:
42+
The following example demonstrates how to recover [NotFound][] exceptions:
4143

4244
```php
4345
<?php
@@ -60,7 +62,7 @@ $events->attach(function (RecoverEvent $event, NotFound $target) {
6062
$responder_with_recovery = new Responder\WithRecovery($responder);
6163
```
6264

63-
Alternatively you can provide another exception to throw instead:
65+
Alternatively, you can provide another exception to throw instead:
6466

6567
```php
6668
<?php
@@ -81,17 +83,17 @@ $responder_with_recovery = new Responder\WithRecovery($responder);
8183
```
8284

8385

84-
## Events around respond
86+
## Events around respond()
8587

86-
[WithEvents][] decorates another responder to emit events around the `respond()` method.
88+
[WithEvent][] decorates another responder to emit events around the `respond()` method.
8789

88-
- [BeforeRespondEvent][] is emitted before the `respond()` method. Listeners can use the event to
89-
alter the request or provide a response. If a response is provided the `respond()` method is *not*
90-
invoked.
91-
- [RespondEvent][] is emitted after the `respond()` method. Listeners can use the event to alter the
92-
response.
90+
1. [BeforeRespondEvent][] is emitted before the `respond()` method.
91+
Listeners can use the event to alter the request or provide a response.
92+
If a response is provided the `respond()` method is NOT invoked.
93+
2. [RespondEvent][] is emitted after the `respond()` method.
94+
Listeners can use the event to alter the response.
9395

94-
The following example demonstrate how to decorate a responder:
96+
The following example demonstrates how to decorate a responder:
9597

9698
```php
9799
<?php
@@ -103,7 +105,7 @@ namespace ICanBoogie\HTTP;
103105
$responder_with_events = new Responder\WithEvents($responder);
104106
```
105107

106-
The following example demonstrate how to attach listeners:
108+
The following example demonstrates how to attach listeners:
107109

108110
```php
109111
<?php
@@ -128,3 +130,6 @@ $events->attach(function (RespondEvent $event) {
128130
[WithRecovery]: ../lib/Responder/WithRecovery.php
129131
[RecoverEvent]: ../lib/RecoverEvent.php
130132
[NotFound]: ../lib/NotFound.php
133+
[WithEvent]: ../lib/Responder/WithEvent
134+
[BeforeRespondEvent]: ../lib/Responder/WithEvent/BeforeRespondEvent.php
135+
[RespondEvent]: ../lib/Responder/WithEvent/RespondEvent.php

0 commit comments

Comments
 (0)