Fix documentation

This commit is contained in:
Sebastian Meyer 2024-07-13 15:26:50 +02:00
parent d8b25299b2
commit 5ea1c8012c
3 changed files with 10 additions and 13 deletions

View File

@ -11,9 +11,8 @@ handing it over to the next middleware in line, and later processes the response
middleware. Originally both methods just return their argument unchanged, so you should implement either one of them or middleware. Originally both methods just return their argument unchanged, so you should implement either one of them or
both as needed. both as needed.
The `AbstractMiddleware` implements the The `AbstractMiddleware` implements the `Psr\Http\Server\MiddlewareInterface` following PHP-FIG's recommendation
`Psr\Http\Server\MiddlewareInterface <https://www.php-fig.org/psr/psr-15/#22-psrhttpservermiddlewareinterface>`_ `PSR-15: HTTP Server Request Handlers <https://www.php-fig.org/psr/psr-15/>`_.
following PHP-FIG's recommendation `PSR-15: HTTP Server Request Handlers <https://www.php-fig.org/psr/psr-15/>`_.
Properties Properties
========== ==========
@ -41,7 +40,7 @@ The default method of `AbstractMiddleware` just returns the request unchanged. I
have to implement your own `processRequest()` method. It takes a request object as only argument and must return a have to implement your own `processRequest()` method. It takes a request object as only argument and must return a
valid request object as well. Just make sure it follows PHP-FIG's standard recommendation valid request object as well. Just make sure it follows PHP-FIG's standard recommendation
`PSR-7: HTTP Message Interfaces <https://www.php-fig.org/psr/psr-7/>`_ and implements the `PSR-7: HTTP Message Interfaces <https://www.php-fig.org/psr/psr-7/>`_ and implements the
`Psr\Http\Message\ServerRequestInterface <https://www.php-fig.org/psr/psr-7/#321-psrhttpmessageserverrequestinterface>`_. `Psr\Http\Message\ServerRequestInterface`.
Processing a Response Processing a Response
--------------------- ---------------------
@ -50,4 +49,4 @@ The default method of `AbstractMiddleware` just returns the response unchanged.
you have to implement your own `processResponse()` method. It takes a response object as only argument and must return you have to implement your own `processResponse()` method. It takes a response object as only argument and must return
a valid response object as well. Just make sure it follows PHP-FIG's standard recommendation a valid response object as well. Just make sure it follows PHP-FIG's standard recommendation
`PSR-7: HTTP Message Interfaces <https://www.php-fig.org/psr/psr-7/>`_ and implements the `PSR-7: HTTP Message Interfaces <https://www.php-fig.org/psr/psr-7/>`_ and implements the
`Psr\Http\Message\ResponseInterface <https://www.php-fig.org/psr/psr-7/#33-psrhttpmessageresponseinterface>`_. `Psr\Http\Message\ResponseInterface`.

View File

@ -9,7 +9,7 @@ MiddlewareQueue
The `MiddlewareQueue` manages the middlewares involved in processing a server request. It makes sure they are called in The `MiddlewareQueue` manages the middlewares involved in processing a server request. It makes sure they are called in
first-in, first-out (FIFO) order, i.e. the same order they were added to the queue. It also ensures all middlewares are first-in, first-out (FIFO) order, i.e. the same order they were added to the queue. It also ensures all middlewares are
implementing the `PSR-15: HTTP Server Request Handlers <https://www.php-fig.org/psr/psr-15/>`_ specification for the implementing the `PSR-15: HTTP Server Request Handlers <https://www.php-fig.org/psr/psr-15/>`_ specification for the
`Psr\Http\Server\MiddlewareInterface <https://www.php-fig.org/psr/psr-15/#22-psrhttpservermiddlewareinterface>`_. `Psr\Http\Server\MiddlewareInterface`.
When instantiating a `MiddlewareQueue` it defaults to being empty. But you can optionally pass an iterable set of When instantiating a `MiddlewareQueue` it defaults to being empty. But you can optionally pass an iterable set of
middlewares to the constructor which are then put into the queue. To demonstrate, the following examples both have middlewares to the constructor which are then put into the queue. To demonstrate, the following examples both have
@ -35,8 +35,7 @@ exactly the same result.
$queue->enqueue(new MiddlewareOne()); $queue->enqueue(new MiddlewareOne());
$queue->enqueue(new MiddlewareTwo()); $queue->enqueue(new MiddlewareTwo());
The `MiddlewareQueue` is based on a The `MiddlewareQueue` is based on a `OCC\Basics\DataStructures\StrictQueue`.
`OCC\Basics\DataStructures\StrictQueue <https://opencultureconsulting.github.io/php-basics/guides/overview/datastructures.html#strictqueue>`_.
Methods Methods
======= =======

View File

@ -10,9 +10,8 @@ The `QueueRequestHandler` is the core piece of this package. It fetches incoming
queue of middlewares and finally sends the response back to the client. It also catches any exceptions not handled by queue of middlewares and finally sends the response back to the client. It also catches any exceptions not handled by
a middleware and turns them into a proper HTTP error response. a middleware and turns them into a proper HTTP error response.
The `QueueRequestHandler` implements the The `QueueRequestHandler` implements the `Psr\Http\Server\RequestHandlerInterface` following PHP-FIG's recommendation
`Psr\Http\Server\RequestHandlerInterface <https://www.php-fig.org/psr/psr-15/#21-psrhttpserverrequesthandlerinterface>`_ `PSR-15: HTTP Server Request Handlers <https://www.php-fig.org/psr/psr-15/>`_.
following PHP-FIG's recommendation `PSR-15: HTTP Server Request Handlers <https://www.php-fig.org/psr/psr-15/>`_.
For a minimal working example have a look at :doc:`../usage/usage`. For a minimal working example have a look at :doc:`../usage/usage`.
@ -58,7 +57,7 @@ HTTP Server Request
The server request is always available as `QueueRequestHandler::request`. It follows PHP-FIG's standard recommendation The server request is always available as `QueueRequestHandler::request`. It follows PHP-FIG's standard recommendation
`PSR-7: HTTP Message Interfaces <https://www.php-fig.org/psr/psr-7/>`_ and implements the `PSR-7: HTTP Message Interfaces <https://www.php-fig.org/psr/psr-7/>`_ and implements the
`Psr\Http\Message\ServerRequestInterface <https://www.php-fig.org/psr/psr-7/#321-psrhttpmessageserverrequestinterface>`_. `Psr\Http\Message\ServerRequestInterface`.
When instantiating a `QueueRequestHandler` the `$request` property is initially set by fetching the actual server When instantiating a `QueueRequestHandler` the `$request` property is initially set by fetching the actual server
request data from superglobals. The property is reset each time the request is passed through a middleware and thus request data from superglobals. The property is reset each time the request is passed through a middleware and thus
@ -69,7 +68,7 @@ HTTP Response
The response can be read as `QueueRequestHandler::response`. It also follows PHP-FIG's standard recommendation The response can be read as `QueueRequestHandler::response`. It also follows PHP-FIG's standard recommendation
`PSR-7: HTTP Message Interfaces <https://www.php-fig.org/psr/psr-7/>`_ and implements the `PSR-7: HTTP Message Interfaces <https://www.php-fig.org/psr/psr-7/>`_ and implements the
`Psr\Http\Message\ResponseInterface <https://www.php-fig.org/psr/psr-7/#33-psrhttpmessageresponseinterface>`_. `Psr\Http\Message\ResponseInterface`.
When instantiating a `QueueRequestHandler` the `$response` property is initially set as a blank HTTP response with When instantiating a `QueueRequestHandler` the `$response` property is initially set as a blank HTTP response with
status code `200`. The property is reset each time the response is passed through a middleware and thus status code `200`. The property is reset each time the response is passed through a middleware and thus