diff --git a/.phpdoc/guide/changelog.rst b/.phpdoc/guide/changelog.rst new file mode 100644 index 0000000..9486680 --- /dev/null +++ b/.phpdoc/guide/changelog.rst @@ -0,0 +1,34 @@ +.. title:: Changelog + +Changelog +######### + +.. sidebar:: Table of Contents + .. contents:: + +v1.1.0 +====== + +**New Features:** + +* Extended `documentation `_ + +**Minor Changes:** + +* Added Composer commands for development tools (PHP_CodeSniffer, PHP-CS-Fixer, PHPStan, Psalm and phpDocumentor) + +**Maintencance:** + +* Updated dependencies + +v1.0.1 +====== + +**Maintenance:** + +* Updated dependencies + +v1.0.0 +====== + +**Initial Release** diff --git a/.phpdoc/guide/index.rst b/.phpdoc/guide/index.rst new file mode 100644 index 0000000..c68d6ba --- /dev/null +++ b/.phpdoc/guide/index.rst @@ -0,0 +1,11 @@ +.. title:: PSR-15 Queue + +Documentation +############# + +.. toctree:: + :maxdepth: 2 + + overview/index + usage/index + changelog diff --git a/.phpdoc/guide/overview/abstractmiddleware.rst b/.phpdoc/guide/overview/abstractmiddleware.rst new file mode 100644 index 0000000..b638b92 --- /dev/null +++ b/.phpdoc/guide/overview/abstractmiddleware.rst @@ -0,0 +1,5 @@ +.. title:: AbstractMiddleware + +AbstractMiddleware +################## + diff --git a/.phpdoc/guide/overview/index.rst b/.phpdoc/guide/overview/index.rst new file mode 100644 index 0000000..c19de23 --- /dev/null +++ b/.phpdoc/guide/overview/index.rst @@ -0,0 +1,22 @@ +.. title:: Overview + +Overview +######## + +The package contains an implementation of `PSR-15: HTTP Server Request Handlers `_ +in a queue-based variant. A :doc:`queuerequesthandler` handles an incoming HTTP request by passing it through a queue +of one or more middlewares. The :doc:`middlewarequeue` provides the middlewares in first-in, first-out (FIFO) order, +i.e. the HTTP request is passed from middleware to middleware preserving the order in which the middlewares were added +to the queue. An :doc:`abstractmiddleware` helps developing your own middlewares, but you can also use any middleware +implementing the `Psr\Http\Server\MiddlewareInterface `_. + +All files share the highest coding standards of `PHPStan `_ and `Psalm `_, +and full `PSR-12 `_ compliance to make sure they can be combined and easily used +in other projects. + +.. toctree:: + :maxdepth: 2 + + queuerequesthandler + middlewarequeue + abstractmiddleware diff --git a/.phpdoc/guide/overview/middlewarequeue.rst b/.phpdoc/guide/overview/middlewarequeue.rst new file mode 100644 index 0000000..2d95d87 --- /dev/null +++ b/.phpdoc/guide/overview/middlewarequeue.rst @@ -0,0 +1,5 @@ +.. title:: MiddlewareQueue + +MiddlewareQueue +############### + diff --git a/.phpdoc/guide/overview/queuerequesthandler.rst b/.phpdoc/guide/overview/queuerequesthandler.rst new file mode 100644 index 0000000..f354dc9 --- /dev/null +++ b/.phpdoc/guide/overview/queuerequesthandler.rst @@ -0,0 +1,5 @@ +.. title:: QueueRequestHandler + +QueueRequestHandler +################### + diff --git a/.phpdoc/guide/usage/index.rst b/.phpdoc/guide/usage/index.rst new file mode 100644 index 0000000..5a1e47e --- /dev/null +++ b/.phpdoc/guide/usage/index.rst @@ -0,0 +1,15 @@ +.. title:: User Guide + +User Guide +########## + +The *Queue-based HTTP Server Request Handler* is a library package, not a stand-alone application. The following +documentation of requirements and installation procedures describes how to make use of the classes within your own +application. For a detailed description of the package's contents have a look at the :doc:`../overview/index` page. + +.. toctree:: + :maxdepth: 2 + + requirements + installation + usage diff --git a/.phpdoc/guide/usage/installation.rst b/.phpdoc/guide/usage/installation.rst new file mode 100644 index 0000000..72ec57b --- /dev/null +++ b/.phpdoc/guide/usage/installation.rst @@ -0,0 +1,59 @@ +.. title:: Installation + +Installation +############ + +.. sidebar:: Table of Contents + .. contents:: + +Composer +======== + +The intended and recommended way of re-using this package is via `Composer `_. The following +command will get you the latest version and make it a dependency of your project. It will also request all dependencies +and register all classes with the autoloader to make them available inside the application. + +.. code-block:: shell + + # This will install the latest stable version suitable for your project + composer require "opencultureconsulting/psr15" + +If you want to use a specific version other than the latest available for your environment, you can do so by appending +the desired version constraint: + +.. code-block:: shell + + # This will install the latest patch level version of 1.1 (i. e. >=1.1.0 && <1.2.0) + composer require "opencultureconsulting/psr15:~1.1" + +All available versions as well as further information about :doc:`requirements` and dependencies can be found on +`Packagist `_. + +Git +=== + +Alternatively, you can fetch the files from `GitHub `_ and add them to +your project manually. The best way is by cloning the repository, because then you can easily update to a newer version +by just pulling the changes and checking out a different version tag. + +.. code-block:: shell + + # This will clone the repository into the "psr15" directory + git clone https://github.com/opencultureconsulting/psr-15.git psr15 + +If you want to use a specific version other than the latest development state, you have to specify the desired tag as +well: + +.. code-block:: shell + + # This will clone the repository state at version "1.1.0" into the "psr15" directory + git clone --branch=v1.1.0 https://github.com/opencultureconsulting/psr-15.git psr15 + +Be aware that you also need to make the classes available in your application by either adding them to your autoloader +or by including all files individually in PHP. Also don't forget to do the same for all :doc:`requirements`. + +Download +======== + +As a last resort you can also just download the files. You can find all available versions as well as the current +development state on the `GitHub release page `_. diff --git a/.phpdoc/guide/usage/requirements.rst b/.phpdoc/guide/usage/requirements.rst new file mode 100644 index 0000000..6b0d34d --- /dev/null +++ b/.phpdoc/guide/usage/requirements.rst @@ -0,0 +1,27 @@ +.. title:: Requirements + +Requirements +############ + +Environment +=========== + +This package requires at least **PHP 8.1**. + +It is highly recommended to use `Composer `_ for dependency management and autoloading, +although it is technically not strictly required for using any of these classes. But it certainly makes it a lot +easier! + +Dependencies +============ + +This package obviously depends on `psr/http-server-handler `_ +and `psr/http-server-middleware `_ which define the standard +`PSR-15: HTTP Server Request Handlers `_ interfaces. + +It uses the `PSR-7: HTTP Message `_ implementations for server request and response +of the great `guzzlehttp/psr7 `_ library. + +The middleware queue is based on a `StrictQueue `_ +of the `opencultureconsulting/basics `_ package which also +provides some useful traits. diff --git a/.phpdoc/guide/usage/usage.rst b/.phpdoc/guide/usage/usage.rst new file mode 100644 index 0000000..cb265ff --- /dev/null +++ b/.phpdoc/guide/usage/usage.rst @@ -0,0 +1,157 @@ +.. title:: Usage + +Usage +##### + +.. sidebar:: Table of Contents + .. contents:: + +The following example shows a very basic *Queue-based HTTP Server Request Handler* using just two simple middlewares +(called `MiddlewareOne` and `MiddlewareTwo`). + +Middlewares +=========== + +First of all, we need some middlewares to process our server request. Although we could use any middleware implementing +the `Psr/Http/Server/MiddlewareInterface` (e.g. from `this great collection `_), we +will write our own using the :doc:`../overview/abstractmiddleware` provided by this package. + +The abstract middleware already implements a complete middleware, but it will just pass requests through without doing +anything. In order to have it do something, we need to implement our own :php:method:`OCC\PSR15\AbstractMiddleware::processRequest()` +or :php:method:`OCC\PSR15\AbstractMiddleware::processResponse()` method, or both of them. + +The logic here is the same as with every `PSR-15: HTTP Server Request Handler `_ +middleware: The request gets passed through all middlewares' `processRequest()` methods in order of their addition to +the queue, then a response is created and passed through all `processResponse()` methods, **but in reverse order**! So +the first middleware in the queue gets the request first, but the response last. + +Our first middleware is very simple and just adds an attribute to the server request. + +.. code-block:: php + use OCC\PSR15\AbstractMiddleware; + use Psr\Http\Message\ServerRequestInterface as ServerRequest; + + class MiddlewareOne extends AbstractMiddleware + { + /** + * Process an incoming server request before delegating to next middleware. + * + * @param ServerRequest $request The incoming server request + * + * @return ServerRequest The processed server request + */ + protected function processRequest(ServerRequest $request): ServerRequest + { + // Let's just add a new attribute to the request to later check + // which middleware was passed last. + return $request->withAttribute('LastMiddlewarePassed', 'MiddlewareOne'); + } + } + +For a queue to make sense we need at least a second middleware, so let's create another one. Again, we will add an +attribute to the request, but with the same name. So, whichever middleware handles the request last overwrites the +attribute with its value. This way we can later check if our middlewares were passed in the correct order. + +.. code-block:: php + use OCC\PSR15\AbstractMiddleware; + use Psr\Http\Message\ServerRequestInterface as ServerRequest; + + class MiddlewareTwo extends AbstractMiddleware + { + /** + * Process an incoming server request before delegating to next middleware. + * + * @param ServerRequest $request The incoming server request + * + * @return ServerRequest The processed server request + */ + protected function processRequest(ServerRequest $request): ServerRequest + { + // We add the same request attribute as in MiddlewareOne, effectively + // overwriting its value. + return $request->withAttribute('LastMiddlewarePassed', 'MiddlewareTwo'); + } + } + +Also, we want to set the status code of the response according to the final value of our request attribute. Therefore, +we need to implement `processResponse()` as well. We can do that in either one of our middlewares because it's the only +response manipulation in our example, so the order of processing doesn't make a difference (remember: `MiddlewareTwo` +gets to handle the response before `MiddlewareOne`). Let's go with `MiddlewareTwo`. + +.. code-block:: php + use OCC\PSR15\AbstractMiddleware; + use Psr\Http\Message\ResponseInterface as Response; + use Psr\Http\Message\ServerRequestInterface as ServerRequest; + + class MiddlewareTwo extends AbstractMiddleware + { + // MiddlewareTwo::processRequest() remains unchanged (see above). + + /** + * Process an incoming response before returning it to previous middleware. + * + * @param Response $response The incoming response + * + * @return Response The processed response + */ + protected function processResponse(Response $response): Response + { + // First we need to get the request attribute. + $lastMiddlewarePassed = $this->requestHandler->request->getAttribute('LastMiddlewarePassed'); + if ($lastMiddlewarePassed === 'MiddlewareTwo') { + // Great, MiddlewareTwo was passed after MiddlewareOne, + // let's return status code 200! + return $response->withStatus(200); + } else { + // Oh no, something went wrong! We'll send status code 500. + return $response->withStatus(500); + } + } + } + +Well done! We now have two middlewares. + +Request Handler +=============== + +Let's use a :doc:`../overview/queuerequesthandler` to pass a server request through both of our middlewares in the +correct order. + +.. code-block:: php + use OCC\PSR15\QueueRequestHandler; + + // First of all, we instantiate the request handler. + // At this point we could already provide an array of middlewares as argument and + // skip the next step, but then we wouldn't learn how to use the MiddlewareQueue. + $requestHandler = new QueueRequestHandler(); + + // We can access the MiddlewareQueue as a property of the request handler. + // Let's add both of our middlewares, MiddlewareOne and MiddlewareTwo. Since + // this is a FIFO queue, the order is very important! + $requestHandler->queue->enqueue(new MiddlewareOne()); + $requestHandler->queue->enqueue(new MiddlewareTwo()); + + // And we are ready to handle incoming requests! + // We don't even need to pass the server request to this method, because + // the constructor already took care of that! + $finalResponse = $requestHandler->handle(); + + // Now we can pass the final response back to our application. + // Alternatively, we can also return it directly to the client. + $requestHandler->respond(); + + // If we did everything right, the client should now receive an HTTP response + // with status code 200 (OK). + +And that's it! + +Diving Deeper +============= + +To familiarize yourself with the FIFO principle of the middleware queue, you can try to exchange the two lines adding +the middlewares to the queue, i.e. adding `MiddlewareTwo` first and `MiddlewareOne` second. This will result in an HTTP +response with status code `500 (Internal Server Error)`. + +This is exactly what we intended: Have a look at `MiddlewareTwo::processResponse()` again! If `$lastMiddlewarePassed` +is not `MiddlewareTwo` (which it isn't when `MiddlewareOne` is added to the queue after `MiddlewareTwo`), we set the +response status code to `500`. diff --git a/.phpdoc/template/components/sidebar.html.twig b/.phpdoc/template/components/sidebar.html.twig new file mode 100644 index 0000000..46192c9 --- /dev/null +++ b/.phpdoc/template/components/sidebar.html.twig @@ -0,0 +1,31 @@ + + + diff --git a/.phpdoc/template/components/toc.html.twig b/.phpdoc/template/components/toc.html.twig new file mode 100644 index 0000000..7ff0a75 --- /dev/null +++ b/.phpdoc/template/components/toc.html.twig @@ -0,0 +1,19 @@ +{% for version in project.versions %} + {% for toc in version.tableOfContents|filter(toc => toc.name|lower == "documentation" or toc.name|lower == "packages") %} +

{{ toc.name|title }}

+
+ {% for root in toc.roots %} +
+ {{ root.title|shortFQSEN }} +
+ {% if root.children.count > 0 %} +
+ {% for child in root.children %} + {{ child.title|shortFQSEN }}
+ {% endfor %} +
+ {% endif %} + {% endfor %} +
+ {% endfor %} +{% endfor %} diff --git a/.phpdoc/template/components/topnav.html.twig b/.phpdoc/template/components/topnav.html.twig new file mode 100644 index 0000000..02c07d4 --- /dev/null +++ b/.phpdoc/template/components/topnav.html.twig @@ -0,0 +1,30 @@ +{% +set topMenu = { + "menu": [ + { "iconClass": "fab fa-php", "url": "https://packagist.org/packages/opencultureconsulting/basics"}, + { "iconClass": "fab fa-github", "url": "https://github.com/opencultureconsulting/php-basics"} + ] +} +%} + + diff --git a/.phpdoc/template/css/custom.css.twig b/.phpdoc/template/css/custom.css.twig new file mode 100644 index 0000000..e6320d0 --- /dev/null +++ b/.phpdoc/template/css/custom.css.twig @@ -0,0 +1,134 @@ +aside.phpdocumentor-sidebar +{ + display: flex; + flex-direction: column; +} + +aside.phpdocumentor-sidebar + section.-documentation +{ + order: 1; +} + +aside.phpdocumentor-sidebar + section.-packages +{ + order: 2; +} + +aside.phpdocumentor-sidebar + section.-namespaces +{ + order: 3; +} + +aside.phpdocumentor-sidebar + section.-reports +{ + order: 4; +} + +aside.phpdocumentor-sidebar + section.-indices +{ + order: 5; +} + +aside.phpdocumentor-sidebar + ul.phpdocumentor-list +{ + padding: 0 var(--spacing-md) !important; +} + +p > code, +li > code, +code.prettyprint +{ + background-color: var(--code-background-color); + border: 1px solid #f0f0f0; + border-radius: var(--border-radius-base-size); + box-sizing: border-box; + font-size: var(--text-sm); + padding: var(--spacing-xxxs); +} + +@media (max-width: 999px) { +div.admonition-wrapper +{ + display: none; +} +} + +@media (min-width: 1000px) { +div.admonition-wrapper +{ + display: block; + float: right; + padding: var(--spacing-md); + margin: 0 0 var(--spacing-md) var(--spacing-md); + width: auto; + font-size: var(--text-sm); + border: 1px solid var(--primary-color-lighten); +} +} + +div.admonition-wrapper + p.sidebar-title +{ + font-weight: bold; +} + +div.contents + ul.phpdocumentor-list +{ + margin-bottom: 0; +} + +div.phpdocumentor-content + div.section + ul +{ + padding-left: var(--spacing-lg); +} + +div.phpdocumentor-content + div.section + ul + li +{ + padding-bottom: 0; +} + + +dl.phpdocumentor-table-of-contents + dt.phpdocumentor-table-of-contents__entry.-documentation:before +{ + content: 'D'; +} + +h2.phpdocumentor-content__title +{ + display: flex; + flex-direction: column; +} + +h2.phpdocumentor-content__title + div.phpdocumentor-element__package +{ + order: 1; +} + +h2.phpdocumentor-content__title + span.phpdocumentor-element__extends, +h2.phpdocumentor-content__title + span.phpdocumentor-element__implements +{ + font-size: calc(var(--text-xxs) / 1.2 / 1.2); + order: 2; +} + +h2.phpdocumentor-content__title + span:first-letter +{ + text-transform: lowercase; +} diff --git a/.phpdoc/template/index.html.twig b/.phpdoc/template/index.html.twig new file mode 100644 index 0000000..ebfd865 --- /dev/null +++ b/.phpdoc/template/index.html.twig @@ -0,0 +1,30 @@ +{% extends 'base.html.twig' %} + +{% block content %} +
+ + +

Queue-based HTTP Server Request Handler

+ +

An implementation of PSR-15: HTTP + Server Request Handlers.

+ +

The PHP Standard Recommendation PSR-15 defines interfaces for server request handlers and proposes a queue-based + implementation using different middlewares for processing requests and preparing responses. This package follows + those guidelines and provides a HTTP server request handler + implementation using a middleware queue. It also contains an + abstract class for middlewares to ease the process of writing + your own middleware, but you can just as well use any middleware that implements the middleware interface specified + by PSR-15 (e.g. from the awesome PSR-15 HTTP Middlewares project).

+ +

All components of this package follow the highest coding standards of PHPStan + and Psalm, and comply to PSR-12 + code style guidelines to make sure they can be combined and easily re-used in other projects.

+ +

Table of Contents

+ + {% include('components/toc.html.twig') %} +
+{% endblock %} diff --git a/README.md b/README.md index ff1e39d..bd9baa2 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,15 @@ The PHP Standard Recommendation PSR-15 defines interfaces for server request handlers and proposes a queue-based implementation using different middlewares for processing requests and preparing responses. This package follows those guidelines and provides a [HTTP server request handler](src/QueueRequestHandler.php) implementation using a [middleware queue](src/MiddlewareQueue.php). It also contains an [abstract class for middlewares](src/AbstractMiddleware.php) to ease the process of writing your own middleware, but you can just as well use any middleware that implements `Psr\Http\Server\MiddlewareInterface` specified by PSR-15 (e.g. from the awesome [PSR-15 HTTP Middlewares](https://github.com/middlewares) project). -All components of this package follow the highest coding standards of [PHPStan](https://phpstan.org/) and [Psalm](https://psalm.dev/), and comply to [PSR-12](https://www.php-fig.org/psr/psr-12/) code style guidelines to make sure they can be combined and easily re-used in other projects. +All components of this package follow the highest coding standards of [PHPStan](https://phpstan.org/) and [Psalm](https://psalm.dev/), and comply to [PSR-12](https://www.php-fig.org/psr/psr-12/) code style guidelines to make sure they can be combined and easily used in other projects. ## Quick Start -The intended and recommended way of re-using this package is via [Composer](https://getcomposer.org/). The following command will get you the latest version: +The intended and recommended way of using this package is via [Composer](https://getcomposer.org/). The following command will get you the latest version: - composer require opencultureconsulting/psr15 +```shell +composer require opencultureconsulting/psr15 +``` All available versions as well as further information about requirements and dependencies can be found on [Packagist](https://packagist.org/packages/opencultureconsulting/psr15). diff --git a/doc/classes/OCC-PSR15-AbstractMiddleware.html b/doc/classes/OCC-PSR15-AbstractMiddleware.html new file mode 100644 index 0000000..18e34d9 --- /dev/null +++ b/doc/classes/OCC-PSR15-AbstractMiddleware.html @@ -0,0 +1,681 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + +
+

PSR-15 Queue

+ + + + + + +
+ +
+
+ + + + +
+
+ + +
+

+ AbstractMiddleware + + +
+ in package + +
+ + + implements + MiddlewareInterface + +

+ +
+ + +
AbstractYes
+ +
+ + + +

Abstract class implementing \Psr\Http\Server\MiddlewareInterface.

+ + + + +
+ Tags + + +
+
+
+ author +
+
+ +

Sebastian Meyer sebastian.meyer@opencultureconsulting.com

+
+ +
+
+ + + + + +

+ Table of Contents + + +

+ + + +

+ Interfaces + + +

+
+
MiddlewareInterface
+ + + + + + + +

+ Methods + + +

+
+
+ __invoke() + +  : ResponseInterface +
+
Allow the middleware to be invoked directly.
+ +
+ process() + +  : ResponseInterface +
+
Process an incoming server request and produce a response.
+ +
+ processRequest() + +  : ServerRequestInterface +
+
Process an incoming server request before delegating to next middleware.
+ +
+ processResponse() + +  : ResponseInterface +
+
Process an incoming response before returning it to previous middleware.
+ +
+ + + + + + + +
+

+ Methods + + +

+
+

+ __invoke() + + +

+ + +

Allow the middleware to be invoked directly.

+ + + public + final __invoke(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface + +
+
APIYes
+ +
+ + +
Parameters
+
+
+ $request + : ServerRequestInterface +
+
+

The server request to process

+
+ +
+
+ $handler + : RequestHandlerInterface +
+
+

The request handler to delegate to

+
+ +
+
+ + + + + +
+
Return values
+ ResponseInterface + — +

The response object

+
+ +
+ +
+
+

+ process() + + +

+ + +

Process an incoming server request and produce a response.

+ + + public + final process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface + +
+
APIYes
+ +
+ + +
Parameters
+
+
+ $request + : ServerRequestInterface +
+
+

The server request to process

+
+ +
+
+ $handler + : RequestHandlerInterface +
+
+

The request handler to delegate to

+
+ +
+
+ + + + + +
+
Return values
+ ResponseInterface + — +

The response object

+
+ +
+ +
+
+

+ processRequest() + + +

+ + +

Process an incoming server request before delegating to next middleware.

+ + + protected + processRequest(ServerRequestInterface $request) : ServerRequestInterface + +
+
+ + +
Parameters
+
+
+ $request + : ServerRequestInterface +
+
+

The incoming server request

+
+ +
+
+ + + + + +
+
Return values
+ ServerRequestInterface + — +

The processed server request

+
+ +
+ +
+
+

+ processResponse() + + +

+ + +

Process an incoming response before returning it to previous middleware.

+ + + protected + processResponse(ResponseInterface $response) : ResponseInterface + +
+
+ + +
Parameters
+
+
+ $response + : ResponseInterface +
+
+

The incoming response

+
+ +
+
+ + + + + +
+
Return values
+ ResponseInterface + — +

The processed response

+
+ +
+ +
+
+ +
+
+
+
+

+        
+ +
+
+ + + +
+
+
+ +
+ On this page + + +
+ +
+
+
+
+
+

Search results

+ +
+
+
    +
    +
    +
    +
    + + +
    + + + + + + + + diff --git a/doc/classes/OCC-PSR15-MiddlewareQueue.html b/doc/classes/OCC-PSR15-MiddlewareQueue.html new file mode 100644 index 0000000..cce4eba --- /dev/null +++ b/doc/classes/OCC-PSR15-MiddlewareQueue.html @@ -0,0 +1,509 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + +
    +

    PSR-15 Queue

    + + + + + + +
    + +
    +
    + + + + +
    +
    + + +
    +

    + MiddlewareQueue + + + extends StrictQueue + + +
    + in package + +
    + + + + uses + Singleton +

    + +
    + + +
    + + + +

    Queue of PSR-15 Middlewares to process HTTP Server Requests.

    + + + + +
    + Tags + + +
    +
    +
    + author +
    +
    + +

    Sebastian Meyer sebastian.meyer@opencultureconsulting.com

    +
    + +
    +
    + + + + + +

    + Table of Contents + + +

    + + + + + + + + + + +

    + Methods + + +

    +
    +
    + getInstance() + +  : static +
    + +
    + __construct() + +  : void +
    +
    Create a queue of PSR-15 compatible middlewares.
    + +
    + + + + + + + +
    +

    + Methods + + +

    +
    +

    + getInstance() + + +

    + + + + + public + static getInstance([iterable<string|int, MiddlewareInterface$middlewares = ]) : static + +
    +
    + + +
    Parameters
    +
    +
    + $middlewares + : iterable<string|int, MiddlewareInterface> + =
    +
    + +
    +
    + + + + + +
    +
    Return values
    + static +
    + +
    +
    +

    + __construct() + + +

    + + +

    Create a queue of PSR-15 compatible middlewares.

    + + + private + __construct([iterable<string|int, MiddlewareInterface$middlewares = [] ]) : void + +
    +
    + + +
    Parameters
    +
    +
    + $middlewares + : iterable<string|int, MiddlewareInterface> + = []
    +
    +

    Initial set of PSR-15 middlewares

    +
    + +
    +
    + + + + + + +
    +
    + +
    +
    +
    +
    +
    
    +        
    + +
    +
    + + + +
    +
    +
    + +
    + On this page + + +
    + +
    +
    +
    +
    +
    +

    Search results

    + +
    +
    +
      +
      +
      +
      +
      + + +
      + + + + + + + + diff --git a/doc/classes/OCC-PSR15-QueueRequestHandler.html b/doc/classes/OCC-PSR15-QueueRequestHandler.html new file mode 100644 index 0000000..4868c66 --- /dev/null +++ b/doc/classes/OCC-PSR15-QueueRequestHandler.html @@ -0,0 +1,819 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + +
      +

      PSR-15 Queue

      + + + + + + +
      + +
      +
      + + + + +
      +
      + + +
      +

      + QueueRequestHandler + + +
      + in package + +
      + + + implements + RequestHandlerInterface + + + uses + Getter +

      + +
      + + +
      + + + +

      A queue-based PSR-15 HTTP Server Request Handler.

      + + + + +
      + Tags + + +
      +
      +
      + author +
      +
      + +

      Sebastian Meyer sebastian.meyer@opencultureconsulting.com

      +
      + +
      +
      + + + + + +

      + Table of Contents + + +

      + + + +

      + Interfaces + + +

      +
      +
      RequestHandlerInterface
      + + + + + + +

      + Properties + + +

      +
      +
      + $queue + +  : MiddlewareQueue +
      + +
      + $request + +  : ServerRequestInterface +
      + +
      + $response + +  : ResponseInterface +
      + +
      + +

      + Methods + + +

      +
      +
      + __construct() + +  : void +
      +
      Create a queue-based PSR-15 HTTP Server Request Handler.
      + +
      + __invoke() + +  : ResponseInterface +
      +
      Allow the request handler to be invoked directly.
      + +
      + handle() + +  : ResponseInterface +
      +
      Handles a request by invoking a queue of middlewares.
      + +
      + respond() + +  : void +
      +
      Return the current response to the client.
      + +
      + + + + + + +
      +

      + Properties + + +

      + +
      +

      + $request + + + + read-only +

      + + + + + + public + ServerRequestInterface + $request + + + + + + + + +
      +
      +

      + $response + + + + read-only +

      + + + + + + public + ResponseInterface + $response + + + + + + + + +
      +
      + +
      +

      + Methods + + +

      +
      +

      + __construct() + + +

      + + +

      Create a queue-based PSR-15 HTTP Server Request Handler.

      + + + public + __construct([iterable<string|int, MiddlewareInterface$middlewares = [] ]) : void + +
      +
      + + +
      Parameters
      +
      +
      + $middlewares + : iterable<string|int, MiddlewareInterface> + = []
      +
      +

      Initial set of middlewares

      +
      + +
      +
      + + + + + + +
      +
      +

      + __invoke() + + +

      + + +

      Allow the request handler to be invoked directly.

      + + + public + __invoke([ServerRequestInterface|null $request = null ]) : ResponseInterface + +
      +
      APIYes
      + +
      + + +
      Parameters
      +
      +
      + $request + : ServerRequestInterface|null + = null
      +
      +

      The PSR-7 server request to handle

      +
      + +
      +
      + + + + + +
      +
      Return values
      + ResponseInterface + — +

      A PSR-7 compatible HTTP response

      +
      + +
      + +
      +
      +

      + handle() + + +

      + + +

      Handles a request by invoking a queue of middlewares.

      + + + public + handle([ServerRequestInterface|null $request = null ]) : ResponseInterface + +
      +
      APIYes
      + +
      + + +
      Parameters
      +
      +
      + $request + : ServerRequestInterface|null + = null
      +
      +

      The PSR-7 server request to handle

      +
      + +
      +
      + + + + + +
      +
      Return values
      + ResponseInterface + — +

      A PSR-7 compatible HTTP response

      +
      + +
      + +
      +
      +

      + respond() + + +

      + + +

      Return the current response to the client.

      + + + public + respond([int|null $exitCode = null ]) : void + +
      +
      APIYes
      + +
      + + +
      Parameters
      +
      +
      + $exitCode + : int|null + = null
      +
      +

      Exit code after sending out the response or NULL to continue

      +
      + +
      +
      + + +
      + Tags + + +
      +
      +
      + throws +
      +
      + RuntimeException + +

      if headers were already sent

      +
      + +
      +
      + + + + +
      +
      + +
      +
      +
      +
      +
      
      +        
      + +
      +
      + + + +
      +
      +
      + +
      + On this page + + +
      + +
      +
      +
      +
      +
      +

      Search results

      + +
      +
      +
        +
        +
        +
        +
        + + +
        + + + + + + + + diff --git a/doc/css/base.css b/doc/css/base.css new file mode 100644 index 0000000..08168d7 --- /dev/null +++ b/doc/css/base.css @@ -0,0 +1,1236 @@ + + +:root { + /* Typography */ + --font-primary: 'Open Sans', Helvetica, Arial, sans-serif; + --font-secondary: 'Open Sans', Helvetica, Arial, sans-serif; + --font-monospace: 'Source Code Pro', monospace; + --line-height--primary: 1.6; + --letter-spacing--primary: .05rem; + --text-base-size: 1em; + --text-scale-ratio: 1.2; + + --text-xxs: calc(var(--text-base-size) / var(--text-scale-ratio) / var(--text-scale-ratio) / var(--text-scale-ratio)); + --text-xs: calc(var(--text-base-size) / var(--text-scale-ratio) / var(--text-scale-ratio)); + --text-sm: calc(var(--text-base-size) / var(--text-scale-ratio)); + --text-md: var(--text-base-size); + --text-lg: calc(var(--text-base-size) * var(--text-scale-ratio)); + --text-xl: calc(var(--text-base-size) * var(--text-scale-ratio) * var(--text-scale-ratio)); + --text-xxl: calc(var(--text-base-size) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio)); + --text-xxxl: calc(var(--text-base-size) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio)); + --text-xxxxl: calc(var(--text-base-size) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio)); + --text-xxxxxl: calc(var(--text-base-size) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio)); + + --color-hue-red: 4; + --color-hue-pink: 340; + --color-hue-purple: 291; + --color-hue-deep-purple: 262; + --color-hue-indigo: 231; + --color-hue-blue: 207; + --color-hue-light-blue: 199; + --color-hue-cyan: 187; + --color-hue-teal: 174; + --color-hue-green: 122; + --color-hue-phpdocumentor-green: 96; + --color-hue-light-green: 88; + --color-hue-lime: 66; + --color-hue-yellow: 54; + --color-hue-amber: 45; + --color-hue-orange: 36; + --color-hue-deep-orange: 14; + --color-hue-brown: 16; + + /* Colors */ + --primary-color-hue: var(--color-hue-orange, --color-hue-phpdocumentor-green); + --primary-color-saturation: 57%; + --primary-color: hsl(var(--primary-color-hue), var(--primary-color-saturation), 60%); + --primary-color-darken: hsl(var(--primary-color-hue), var(--primary-color-saturation), 40%); + --primary-color-darker: hsl(var(--primary-color-hue), var(--primary-color-saturation), 25%); + --primary-color-darkest: hsl(var(--primary-color-hue), var(--primary-color-saturation), 10%); + --primary-color-lighten: hsl(var(--primary-color-hue), calc(var(--primary-color-saturation) - 20%), 85%); + --primary-color-lighter: hsl(var(--primary-color-hue), calc(var(--primary-color-saturation) - 45%), 97.5%); + --dark-gray: #d1d1d1; + --light-gray: #f0f0f0; + + --text-color: var(--primary-color-darkest); + + --header-height: var(--spacing-xxxxl); + --header-bg-color: var(--primary-color); + --code-background-color: var(--primary-color-lighter); + --code-border-color: --primary-color-lighten; + --button-border-color: var(--primary-color-darken); + --button-color: transparent; + --button-color-primary: var(--primary-color); + --button-text-color: #555; + --button-text-color-primary: white; + --popover-background-color: rgba(255, 255, 255, 0.75); + --link-color-primary: var(--primary-color-darker); + --link-hover-color-primary: var(--primary-color-darkest); + --form-field-border-color: var(--dark-gray); + --form-field-color: #fff; + --admonition-success-color: var(--primary-color); + --admonition-border-color: silver; + --table-separator-color: var(--primary-color-lighten); + --title-text-color: var(--primary-color); + + --sidebar-border-color: var(--primary-color-lighten); + + /* Grid */ + --container-width: 1400px; + + /* Spacing */ + --spacing-base-size: 1rem; + --spacing-scale-ratio: 1.5; + + --spacing-xxxs: calc(var(--spacing-base-size) / var(--spacing-scale-ratio) / var(--spacing-scale-ratio) / var(--spacing-scale-ratio) / var(--spacing-scale-ratio)); + --spacing-xxs: calc(var(--spacing-base-size) / var(--spacing-scale-ratio) / var(--spacing-scale-ratio) / var(--spacing-scale-ratio)); + --spacing-xs: calc(var(--spacing-base-size) / var(--spacing-scale-ratio) / var(--spacing-scale-ratio)); + --spacing-sm: calc(var(--spacing-base-size) / var(--spacing-scale-ratio)); + --spacing-md: var(--spacing-base-size); + --spacing-lg: calc(var(--spacing-base-size) * var(--spacing-scale-ratio)); + --spacing-xl: calc(var(--spacing-base-size) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio)); + --spacing-xxl: calc(var(--spacing-base-size) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio)); + --spacing-xxxl: calc(var(--spacing-base-size) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio)); + --spacing-xxxxl: calc(var(--spacing-base-size) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio)); + + --border-radius-base-size: 3px; +} + +/* Base Styles +-------------------------------------------------- */ +body { + background-color: #fff; + color: var(--text-color); + font-family: var(--font-primary); + font-size: var(--text-md); + letter-spacing: var(--letter-spacing--primary); + line-height: var(--line-height--primary); + width: 100%; +} + +.phpdocumentor h1, +.phpdocumentor h2, +.phpdocumentor h3, +.phpdocumentor h4, +.phpdocumentor h5, +.phpdocumentor h6 { + margin-bottom: var(--spacing-lg); + margin-top: var(--spacing-lg); + font-weight: 600; +} + +.phpdocumentor h1 { + font-size: var(--text-xxxxl); + letter-spacing: var(--letter-spacing--primary); + line-height: 1.2; + margin-top: 0; +} + +.phpdocumentor h2 { + font-size: var(--text-xxxl); + letter-spacing: var(--letter-spacing--primary); + line-height: 1.25; +} + +.phpdocumentor h3 { + font-size: var(--text-xxl); + letter-spacing: var(--letter-spacing--primary); + line-height: 1.3; +} + +.phpdocumentor h4 { + font-size: var(--text-xl); + letter-spacing: calc(var(--letter-spacing--primary) / 2); + line-height: 1.35; + margin-bottom: var(--spacing-md); +} + +.phpdocumentor h5 { + font-size: var(--text-lg); + letter-spacing: calc(var(--letter-spacing--primary) / 4); + line-height: 1.5; + margin-bottom: var(--spacing-md); + margin-top: var(--spacing-md); +} + +.phpdocumentor h6 { + font-size: var(--text-md); + letter-spacing: 0; + line-height: var(--line-height--primary); + margin-bottom: var(--spacing-md); + margin-top: var(--spacing-md); +} +.phpdocumentor h1 .headerlink, +.phpdocumentor h2 .headerlink, +.phpdocumentor h3 .headerlink, +.phpdocumentor h4 .headerlink, +.phpdocumentor h5 .headerlink, +.phpdocumentor h6 .headerlink +{ + display: none; +} + +@media (min-width: 550px) { + .phpdocumentor h1 .headerlink, + .phpdocumentor h2 .headerlink, + .phpdocumentor h3 .headerlink, + .phpdocumentor h4 .headerlink, + .phpdocumentor h5 .headerlink, + .phpdocumentor h6 .headerlink { + display: inline; + transition: all .3s ease-in-out; + opacity: 0; + text-decoration: none; + color: silver; + font-size: 80%; + } + + .phpdocumentor h1:hover .headerlink, + .phpdocumentor h2:hover .headerlink, + .phpdocumentor h3:hover .headerlink, + .phpdocumentor h4:hover .headerlink, + .phpdocumentor h5:hover .headerlink, + .phpdocumentor h6:hover .headerlink { + opacity: 1; + } +} +.phpdocumentor p { + margin-top: 0; + margin-bottom: var(--spacing-md); +} +.phpdocumentor figure { + margin-bottom: var(--spacing-md); +} + +.phpdocumentor figcaption { + text-align: center; + font-style: italic; + font-size: 80%; +} + +.phpdocumentor-uml-diagram svg { + max-width: 100%; + height: auto !important; +} +.phpdocumentor-line { + border-top: 1px solid #E1E1E1; + border-width: 0; + margin-bottom: var(--spacing-xxl); + margin-top: var(--spacing-xxl); +} +.phpdocumentor-section { + box-sizing: border-box; + margin: 0 auto; + max-width: var(--container-width); + padding: 0 var(--spacing-sm); + position: relative; + width: 100%; +} + +@media (min-width: 550px) { + .phpdocumentor-section { + padding: 0 var(--spacing-lg); + } +} + +@media (min-width: 1200px) { + .phpdocumentor-section { + padding: 0; + width: 95%; + } +} +.phpdocumentor-column { + box-sizing: border-box; + float: left; + width: 100%; +} + +@media (min-width: 550px) { + .phpdocumentor-column { + margin-left: 4%; + } + + .phpdocumentor-column:first-child { + margin-left: 0; + } + + .-one.phpdocumentor-column { + width: 4.66666666667%; + } + + .-two.phpdocumentor-column { + width: 13.3333333333%; + } + + .-three.phpdocumentor-column { + width: 22%; + } + + .-four.phpdocumentor-column { + width: 30.6666666667%; + } + + .-five.phpdocumentor-column { + width: 39.3333333333%; + } + + .-six.phpdocumentor-column { + width: 48%; + } + + .-seven.phpdocumentor-column { + width: 56.6666666667%; + } + + .-eight.phpdocumentor-column { + width: 65.3333333333%; + } + + .-nine.phpdocumentor-column { + width: 74.0%; + } + + .-ten.phpdocumentor-column { + width: 82.6666666667%; + } + + .-eleven.phpdocumentor-column { + width: 91.3333333333%; + } + + .-twelve.phpdocumentor-column { + margin-left: 0; + width: 100%; + } + + .-one-third.phpdocumentor-column { + width: 30.6666666667%; + } + + .-two-thirds.phpdocumentor-column { + width: 65.3333333333%; + } + + .-one-half.phpdocumentor-column { + width: 48%; + } + + /* Offsets */ + .-offset-by-one.phpdocumentor-column { + margin-left: 8.66666666667%; + } + + .-offset-by-two.phpdocumentor-column { + margin-left: 17.3333333333%; + } + + .-offset-by-three.phpdocumentor-column { + margin-left: 26%; + } + + .-offset-by-four.phpdocumentor-column { + margin-left: 34.6666666667%; + } + + .-offset-by-five.phpdocumentor-column { + margin-left: 43.3333333333%; + } + + .-offset-by-six.phpdocumentor-column { + margin-left: 52%; + } + + .-offset-by-seven.phpdocumentor-column { + margin-left: 60.6666666667%; + } + + .-offset-by-eight.phpdocumentor-column { + margin-left: 69.3333333333%; + } + + .-offset-by-nine.phpdocumentor-column { + margin-left: 78.0%; + } + + .-offset-by-ten.phpdocumentor-column { + margin-left: 86.6666666667%; + } + + .-offset-by-eleven.phpdocumentor-column { + margin-left: 95.3333333333%; + } + + .-offset-by-one-third.phpdocumentor-column { + margin-left: 34.6666666667%; + } + + .-offset-by-two-thirds.phpdocumentor-column { + margin-left: 69.3333333333%; + } + + .-offset-by-one-half.phpdocumentor-column { + margin-left: 52%; + } +} +.phpdocumentor a { + color: var(--link-color-primary); +} + +.phpdocumentor a:hover { + color: var(--link-hover-color-primary); +} +.phpdocumentor-button { + background-color: var(--button-color); + border: 1px solid var(--button-border-color); + border-radius: var(--border-radius-base-size); + box-sizing: border-box; + color: var(--button-text-color); + cursor: pointer; + display: inline-block; + font-size: var(--text-sm); + font-weight: 600; + height: 38px; + letter-spacing: .1rem; + line-height: 38px; + padding: 0 var(--spacing-xxl); + text-align: center; + text-decoration: none; + text-transform: uppercase; + white-space: nowrap; + margin-bottom: var(--spacing-md); +} + +.phpdocumentor-button .-wide { + width: 100%; +} + +.phpdocumentor-button:hover, +.phpdocumentor-button:focus { + border-color: #888; + color: #333; + outline: 0; +} + +.phpdocumentor-button.-primary { + background-color: var(--button-color-primary); + border-color: var(--button-color-primary); + color: var(--button-text-color-primary); +} + +.phpdocumentor-button.-primary:hover, +.phpdocumentor-button.-primary:focus { + background-color: var(--link-color-primary); + border-color: var(--link-color-primary); + color: var(--button-text-color-primary); +} +.phpdocumentor form { + margin-bottom: var(--spacing-md); +} + +.phpdocumentor-field { + background-color: var(--form-field-color); + border: 1px solid var(--form-field-border-color); + border-radius: var(--border-radius-base-size); + box-shadow: none; + box-sizing: border-box; + height: 38px; + padding: var(--spacing-xxxs) var(--spacing-xxs); /* The 6px vertically centers text on FF, ignored by Webkit */ + margin-bottom: var(--spacing-md); +} + +/* Removes awkward default styles on some inputs for iOS */ +input[type="email"], +input[type="number"], +input[type="search"], +input[type="text"], +input[type="tel"], +input[type="url"], +input[type="password"], +textarea { + -moz-appearance: none; + -webkit-appearance: none; + appearance: none; +} + +.phpdocumentor-textarea { + min-height: 65px; + padding-bottom: var(--spacing-xxxs); + padding-top: var(--spacing-xxxs); +} + +.phpdocumentor-field:focus { + border: 1px solid var(--button-color-primary); + outline: 0; +} + +label.phpdocumentor-label { + display: block; + margin-bottom: var(--spacing-xs); +} + +.phpdocumentor-fieldset { + border-width: 0; + padding: 0; +} + +input[type="checkbox"].phpdocumentor-field, +input[type="radio"].phpdocumentor-field { + display: inline; +} +.phpdocumentor-column ul, +div.phpdocumentor-list > ul, +ul.phpdocumentor-list { + list-style: circle; +} + +.phpdocumentor-column ol, +div.phpdocumentor-list > ol, +ol.phpdocumentor-list { + list-style: decimal; +} + + +.phpdocumentor-column ul, +div.phpdocumentor-list > ul, +ol.phpdocumentor-list, +ul.phpdocumentor-list { + margin-top: 0; + padding-left: var(--spacing-lg); + margin-bottom: var(--spacing-sm); +} + +.phpdocumentor-column ul.-clean, +div.phpdocumentor-list > ul.-clean, +ul.phpdocumentor-list.-clean { + list-style: none; + padding-left: 0; +} + +dl { + margin-bottom: var(--spacing-md); +} + +.phpdocumentor-column ul ul, +div.phpdocumentor-list > ul ul, +ul.phpdocumentor-list ul.phpdocumentor-list, +ul.phpdocumentor-list ol.phpdocumentor-list, +ol.phpdocumentor-list ol.phpdocumentor-list, +ol.phpdocumentor-list ul.phpdocumentor-list { + font-size: var(--text-sm); + margin: 0 0 0 calc(var(--spacing-xs) * 2); +} + +.phpdocumentor-column ul li, +.phpdocumentor-list li { + padding-bottom: var(--spacing-xs); +} + +.phpdocumentor dl dt { + margin-bottom: var(--spacing-xs); +} + +.phpdocumentor dl dd { + margin-bottom: var(--spacing-md); +} +.phpdocumentor pre { + margin-bottom: var(--spacing-md); +} + +.phpdocumentor-code { + font-family: var(--font-monospace); + background: var(--code-background-color); + border: 1px solid var(--code-border-color); + border-radius: var(--border-radius-base-size); + font-size: var(--text-sm); + padding: var(--spacing-sm) var(--spacing-md); + width: 100%; + box-sizing: border-box; +} + +.phpdocumentor-code.-dark { + background: var(--primary-color-darkest); + color: var(--light-gray); + box-shadow: 0 2px 3px var(--dark-gray); +} + +pre > .phpdocumentor-code { + display: block; + white-space: pre; +} +.phpdocumentor blockquote { + border-left: 4px solid var(--primary-color-darken); + margin: var(--spacing-md) 0; + padding: var(--spacing-xs) var(--spacing-sm); + color: var(--primary-color-darker); + font-style: italic; +} + +.phpdocumentor blockquote p:last-of-type { + margin-bottom: 0; +} +.phpdocumentor table { + margin-bottom: var(--spacing-md); +} + +th.phpdocumentor-heading, +td.phpdocumentor-cell { + border-bottom: 1px solid var(--table-separator-color); + padding: var(--spacing-sm) var(--spacing-md); + text-align: left; +} + +th.phpdocumentor-heading:first-child, +td.phpdocumentor-cell:first-child { + padding-left: 0; +} + +th.phpdocumentor-heading:last-child, +td.phpdocumentor-cell:last-child { + padding-right: 0; +} +.phpdocumentor-label-line { + display: flex; + flex-direction: row; + gap: 1rem +} + +.phpdocumentor-label { + background: #f6f6f6; + border-radius: .25rem; + font-size: 80%; + display: inline-block; + overflow: hidden +} + +/* +It would be better if the phpdocumentor-element class were to become a flex element with a gap, but for #3337 that +is too big a fix and needs to be done in a new design iteration. +*/ +.phpdocumentor-signature + .phpdocumentor-label-line .phpdocumentor-label { + margin-top: var(--spacing-sm); +} + +.phpdocumentor-label span { + display: inline-block; + padding: .125rem .5rem; +} + +.phpdocumentor-label--success span:last-of-type { + background: #abe1ab; +} + +.phpdocumentor-header { + display: flex; + flex-direction: row; + align-items: stretch; + flex-wrap: wrap; + justify-content: space-between; + height: auto; + padding: var(--spacing-md) var(--spacing-md); +} + +.phpdocumentor-header__menu-button { + position: absolute; + top: -100%; + left: -100%; +} + +.phpdocumentor-header__menu-icon { + font-size: 2rem; + color: var(--primary-color); +} + +.phpdocumentor-header__menu-button:checked ~ .phpdocumentor-topnav { + max-height: 250px; + padding-top: var(--spacing-md); +} + +@media (min-width: 1000px) { + .phpdocumentor-header { + flex-direction: row; + padding: var(--spacing-lg) var(--spacing-lg); + min-height: var(--header-height); + } + + .phpdocumentor-header__menu-icon { + display: none; + } +} + +@media (min-width: 1000px) { + .phpdocumentor-header { + padding-top: 0; + padding-bottom: 0; + } +} +@media (min-width: 1200px) { + .phpdocumentor-header { + padding: 0; + } +} +.phpdocumentor-title { + box-sizing: border-box; + color: var(--title-text-color); + font-size: var(--text-xxl); + letter-spacing: .05rem; + font-weight: normal; + width: auto; + margin: 0; + display: flex; + align-items: center; +} + +.phpdocumentor-title.-without-divider { + border: none; +} + +.phpdocumentor-title__link { + transition: all .3s ease-out; + display: flex; + color: var(--title-text-color); + text-decoration: none; + font-weight: normal; + white-space: nowrap; + transform: scale(.75); + transform-origin: left; +} + +.phpdocumentor-title__link:hover { + transform: perspective(15rem) translateX(.5rem); + font-weight: 600; +} + +@media (min-width: 1000px) { + .phpdocumentor-title { + width: 22%; + border-right: var(--sidebar-border-color) solid 1px; + } + + .phpdocumentor-title__link { + transform-origin: left; + } +} + +@media (min-width: 1000px) { + .phpdocumentor-title__link { + transform: scale(.85); + } +} + +@media (min-width: 1200px) { + .phpdocumentor-title__link { + transform: scale(1); + } +} +.phpdocumentor-topnav { + display: flex; + align-items: center; + margin: 0; + max-height: 0; + overflow: hidden; + transition: max-height 0.2s ease-out; + flex-basis: 100%; +} + +.phpdocumentor-topnav__menu { + text-align: right; + list-style: none; + margin: 0; + padding: 0; + flex: 1; + display: flex; + flex-flow: row wrap; + justify-content: center; +} + +.phpdocumentor-topnav__menu-item { + margin: 0; + width: 100%; + display: inline-block; + text-align: center; + padding: var(--spacing-sm) 0 +} + +.phpdocumentor-topnav__menu-item.-social { + width: auto; + padding: var(--spacing-sm) +} + +.phpdocumentor-topnav__menu-item a { + display: inline-block; + color: var(--text-color); + text-decoration: none; + font-size: var(--text-lg); + transition: all .3s ease-out; + border-bottom: 1px dotted transparent; + line-height: 1; +} + +.phpdocumentor-topnav__menu-item a:hover { + transform: perspective(15rem) translateY(.1rem); + border-bottom: 1px dotted var(--text-color); +} + +@media (min-width: 1000px) { + .phpdocumentor-topnav { + max-height: none; + overflow: visible; + flex-basis: auto; + } + + .phpdocumentor-topnav__menu { + display: flex; + flex-flow: row wrap; + justify-content: flex-end; + } + + .phpdocumentor-topnav__menu-item, + .phpdocumentor-topnav__menu-item.-social { + width: auto; + display: inline; + text-align: right; + padding: 0 0 0 var(--spacing-md) + } +} +.phpdocumentor-sidebar { + margin: 0; + overflow: hidden; + max-height: 0; +} + +.phpdocumentor .phpdocumentor-sidebar .phpdocumentor-list { + padding: var(--spacing-xs) var(--spacing-md); + list-style: none; + margin: 0; +} + +.phpdocumentor .phpdocumentor-sidebar li { + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + padding: 0 0 var(--spacing-xxxs) var(--spacing-md); +} + +.phpdocumentor .phpdocumentor-sidebar abbr, +.phpdocumentor .phpdocumentor-sidebar a { + text-decoration: none; + border-bottom: none; + color: var(--text-color); + font-size: var(--text-md); + padding-left: 0; + transition: padding-left .4s ease-out; +} + +.phpdocumentor .phpdocumentor-sidebar a:hover, +.phpdocumentor .phpdocumentor-sidebar a.-active { + padding-left: 5px; + font-weight: 600; +} + +.phpdocumentor .phpdocumentor-sidebar__category > * { + border-left: 1px solid var(--primary-color-lighten); +} + +.phpdocumentor .phpdocumentor-sidebar__category { + margin-bottom: var(--spacing-lg); +} + +.phpdocumentor .phpdocumentor-sidebar__category-header { + font-size: var(--text-md); + margin-top: 0; + margin-bottom: var(--spacing-xs); + color: var(--link-color-primary); + font-weight: 600; + border-left: 0; +} + +.phpdocumentor .phpdocumentor-sidebar__root-package, +.phpdocumentor .phpdocumentor-sidebar__root-namespace { + font-size: var(--text-md); + margin: 0; + padding-top: var(--spacing-xs); + padding-left: var(--spacing-md); + color: var(--text-color); + font-weight: normal; +} + +@media (min-width: 550px) { + .phpdocumentor-sidebar { + border-right: var(--sidebar-border-color) solid 1px; + } +} + +.phpdocumentor-sidebar__menu-button { + position: absolute; + top: -100%; + left: -100%; +} + +.phpdocumentor-sidebar__menu-icon { + font-size: var(--text-md); + font-weight: 600; + background: var(--primary-color); + color: white; + margin: 0 0 var(--spacing-lg); + display: block; + padding: var(--spacing-sm); + text-align: center; + border-radius: 3px; + text-transform: uppercase; + letter-spacing: .15rem; +} + +.phpdocumentor-sidebar__menu-button:checked ~ .phpdocumentor-sidebar { + max-height: 100%; + padding-top: var(--spacing-md); +} + +@media (min-width: 550px) { + .phpdocumentor-sidebar { + overflow: visible; + max-height: 100%; + } + + .phpdocumentor-sidebar__menu-icon { + display: none; + } +} +.phpdocumentor-admonition { + border: 1px solid var(--admonition-border-color); + border-radius: var(--border-radius-base-size); + border-color: var(--primary-color-lighten); + background-color: var(--primary-color-lighter); + padding: var(--spacing-lg); + margin: var(--spacing-lg) 0; + display: flex; + flex-direction: row; + align-items: flex-start; +} + +.phpdocumentor-admonition p:last-of-type { + margin-bottom: 0; +} + +.phpdocumentor-admonition--success, +.phpdocumentor-admonition.-success { + border-color: var(--admonition-success-color); +} + +.phpdocumentor-admonition__icon { + margin-right: var(--spacing-md); + color: var(--primary-color); + max-width: 3rem; +} +.phpdocumentor ul.phpdocumentor-breadcrumbs { + font-size: var(--text-md); + list-style: none; + margin: 0; + padding: 0; +} + +.phpdocumentor ul.phpdocumentor-breadcrumbs a { + color: var(--text-color); + text-decoration: none; +} + +.phpdocumentor ul.phpdocumentor-breadcrumbs > li { + display: inline-block; + margin: 0; +} + +.phpdocumentor ul.phpdocumentor-breadcrumbs > li + li:before { + color: var(--dark-gray); + content: "\\\A0"; + padding: 0; +} +.phpdocumentor .phpdocumentor-back-to-top { + position: fixed; + bottom: 2rem; + font-size: 2.5rem; + opacity: .25; + transition: all .3s ease-in-out; + right: 2rem; +} + +.phpdocumentor .phpdocumentor-back-to-top:hover { + color: var(--link-color-primary); + opacity: 1; +} +.phpdocumentor-search { + position: relative; + display: none; /** disable by default for non-js flow */ + opacity: .3; /** white-out default for loading indication */ + transition: opacity .3s, background .3s; + margin: var(--spacing-sm) 0; + flex: 1; + min-width: 100%; +} + +.phpdocumentor-search label { + display: flex; + align-items: center; + flex: 1; +} + +.phpdocumentor-search__icon { + color: var(--primary-color); + margin-right: var(--spacing-sm); + width: 1rem; + height: 1rem; +} + +.phpdocumentor-search--enabled { + display: flex; +} + +.phpdocumentor-search--active { + opacity: 1; +} + +.phpdocumentor-search input:disabled { + background-color: lightgray; +} + +.phpdocumentor-search__field:focus, +.phpdocumentor-search__field { + margin-bottom: 0; + border: 0; + border-bottom: 2px solid var(--primary-color); + padding: 0; + border-radius: 0; + flex: 1; +} + +@media (min-width: 1000px) { + .phpdocumentor-search { + min-width: auto; + max-width: 20rem; + margin: 0 0 0 auto; + } +} +.phpdocumentor-search-results { + backdrop-filter: blur(5px); + background: var(--popover-background-color); + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + padding: 0; + opacity: 1; + pointer-events: all; + + transition: opacity .3s, background .3s; +} + +.phpdocumentor-search-results--hidden { + background: transparent; + backdrop-filter: blur(0); + opacity: 0; + pointer-events: none; +} + +.phpdocumentor-search-results__dialog { + width: 100%; + background: white; + max-height: 100%; + display: flex; + flex-direction: column; +} + +.phpdocumentor-search-results__body { + overflow: auto; +} + +.phpdocumentor-search-results__header { + padding: var(--spacing-lg); + display: flex; + justify-content: space-between; + background: var(--primary-color-darken); + color: white; + align-items: center; +} + +.phpdocumentor-search-results__close { + font-size: var(--text-xl); + background: none; + border: none; + padding: 0; + margin: 0; +} + +.phpdocumentor .phpdocumentor-search-results__title { + font-size: var(--text-xl); + margin-bottom: 0; +} + +.phpdocumentor-search-results__entries { + list-style: none; + padding: 0 var(--spacing-lg); + margin: 0; +} + +.phpdocumentor-search-results__entry { + border-bottom: 1px solid var(--table-separator-color); + padding: var(--spacing-sm) 0; + text-align: left; +} + +.phpdocumentor-search-results__entry a { + display: block; +} + +.phpdocumentor-search-results__entry small { + margin-top: var(--spacing-xs); + margin-bottom: var(--spacing-md); + color: var(--primary-color-darker); + display: block; + word-break: break-word; +} + +.phpdocumentor-search-results__entry h3 { + font-size: var(--text-lg); + margin: 0; +} + +@media (min-width: 550px) { + .phpdocumentor-search-results { + padding: 0 var(--spacing-lg); + } + + .phpdocumentor-search-results__entry h3 { + font-size: var(--text-xxl); + } + + .phpdocumentor-search-results__dialog { + margin: var(--spacing-xl) auto; + max-width: 40rem; + background: white; + border: 1px solid silver; + box-shadow: 0 2px 5px silver; + max-height: 40rem; + border-radius: 3px; + } +} +.phpdocumentor-modal { + position: fixed; + width: 100vw; + height: 100vh; + opacity: 0; + visibility: hidden; + transition: all 0.3s ease; + top: 0; + left: 0; + display: flex; + align-items: center; + justify-content: center; + z-index: 1; +} + +.phpdocumentor-modal__open { + visibility: visible; + opacity: 1; + transition-delay: 0s; +} + +.phpdocumentor-modal-bg { + position: absolute; + background: gray; + opacity: 50%; + width: 100%; + height: 100%; +} + +.phpdocumentor-modal-container { + border-radius: 1em; + background: #fff; + position: relative; + padding: 2em; + box-sizing: border-box; + max-width:100vw; +} + +.phpdocumentor-modal__close { + position: absolute; + right: 0.75em; + top: 0.75em; + outline: none; + appearance: none; + color: var(--primary-color); + background: none; + border: 0px; + font-weight: bold; + cursor: pointer; +} +.phpdocumentor-on-this-page__sidebar { + display: none; +} + +.phpdocumentor-on-this-page__title { + display: block; + font-weight: bold; + margin-bottom: var(--spacing-sm); + color: var(--link-color-primary); +} + +@media (min-width: 1000px) { + .phpdocumentor-on-this-page__sidebar { + display: block; + position: relative; + } + + .phpdocumentor-on-this-page__content::-webkit-scrollbar, + [scrollbars]::-webkit-scrollbar { + height: 8px; + width: 8px; + } + + .phpdocumentor-on-this-page__content::-webkit-scrollbar-corner, + [scrollbars]::-webkit-scrollbar-corner { + background: 0; + } + + .phpdocumentor-on-this-page__content::-webkit-scrollbar-thumb, + [scrollbars]::-webkit-scrollbar-thumb { + background: rgba(128,134,139,0.26); + border-radius: 8px; + } + + .phpdocumentor-on-this-page__content { + position: sticky; + height: calc(100vh - var(--header-height)); + overflow-y: auto; + border-left: 1px solid var(--sidebar-border-color); + padding-left: var(--spacing-lg); + font-size: 90%; + top: -1px; /* Needed for the javascript to make the .-stuck trick work */ + flex: 0 1 auto; + width: 15vw; + } + + .phpdocumentor-on-this-page__content.-stuck { + height: 100vh; + } + + .phpdocumentor-on-this-page__content li { + word-break: break-all; + line-height: normal; + } + + .phpdocumentor-on-this-page__content li.-deprecated { + text-decoration: line-through; + } +} + +/* Used for screen readers and such */ +.visually-hidden { + display: none; +} + +.float-right { + float: right; +} + +.float-left { + float: left; +} diff --git a/doc/css/normalize.css b/doc/css/normalize.css new file mode 100644 index 0000000..653dc00 --- /dev/null +++ b/doc/css/normalize.css @@ -0,0 +1,427 @@ +/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ + +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + font-family: sans-serif; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Remove default margin. + */ + +body { + margin: 0; +} + +/* HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 + * and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; +} + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ + +audio, +canvas, +progress, +video { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. + */ + +[hidden], +template { + display: none !important; +} + +/* Links + ========================================================================== */ + +/** + * Remove the gray background color from active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +/** + * Address styling not present in Safari and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/** + * Address styling not present in IE 8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove border when inside `a` element in IE 8/9/10. + */ + +img { + border: 0; +} + +/** + * Correct overflow not hidden in IE 9/10/11. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content + ========================================================================== */ + +/** + * Address margin not present in IE 8/9 and Safari. + */ + +figure { + margin: 1em 40px; +} + +/** + * Address differences between Firefox and other browsers. + */ + +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +/** + * Contain overflow in all browsers. + */ + +pre { + overflow: auto; +} + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ + +code, +kbd, +pre, +samp { + font-family: var(--font-monospace); + font-size: 1em; +} + +/* Forms + ========================================================================== */ + +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ + +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ + +button, +input, +optgroup, +select, +textarea { + color: inherit; /* 1 */ + font: inherit; /* 2 */ + margin: 0; /* 3 */ +} + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ + +button { + overflow: visible; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * Remove inner padding and border in Firefox 4+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +input { + line-height: normal; +} + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ + +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome + * (include `-moz` to future-proof). + */ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; /* 2 */ + box-sizing: content-box; +} + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ + +legend { + border: 0; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ + +textarea { + overflow: auto; +} + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ + +optgroup { + font-weight: bold; +} + +/* Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} + +td, +th { + padding: 0; +} diff --git a/doc/css/template.css b/doc/css/template.css new file mode 100644 index 0000000..cdc39e3 --- /dev/null +++ b/doc/css/template.css @@ -0,0 +1,409 @@ + +.phpdocumentor-content { + position: relative; + display: flex; + gap: var(--spacing-md); +} + +.phpdocumentor-content > section:first-of-type { + width: 75%; + flex: 1 1 auto; +} + +@media (min-width: 1900px) { + .phpdocumentor-content > section:first-of-type { + width: 100%; + flex: 1 1 auto; + } +} + +.phpdocumentor .phpdocumentor-content__title { + margin-top: 0; +} +.phpdocumentor-summary { + font-style: italic; +} +.phpdocumentor-description { + margin-bottom: var(--spacing-md); +} +.phpdocumentor-element { + position: relative; +} + +.phpdocumentor-element .phpdocumentor-element { + border: 1px solid var(--primary-color-lighten); + margin-bottom: var(--spacing-md); + padding: var(--spacing-xs); + border-radius: 5px; +} + +.phpdocumentor-element.-deprecated .phpdocumentor-element__name { + text-decoration: line-through; +} + +@media (min-width: 550px) { + .phpdocumentor-element .phpdocumentor-element { + margin-bottom: var(--spacing-lg); + padding: var(--spacing-md); + } +} + +.phpdocumentor-element__modifier { + font-size: var(--text-xxs); + padding: calc(var(--spacing-base-size) / 4) calc(var(--spacing-base-size) / 2); + color: var(--text-color); + background-color: var(--light-gray); + border-radius: 3px; + text-transform: uppercase; +} + +.phpdocumentor .phpdocumentor-elements__header { + margin-top: var(--spacing-xxl); + margin-bottom: var(--spacing-lg); +} + +.phpdocumentor .phpdocumentor-element__name { + line-height: 1; + margin-top: 0; + font-weight: 300; + font-size: var(--text-lg); + word-break: break-all; + margin-bottom: var(--spacing-sm); +} + +@media (min-width: 550px) { + .phpdocumentor .phpdocumentor-element__name { + font-size: var(--text-xl); + margin-bottom: var(--spacing-xs); + } +} + +@media (min-width: 1200px) { + .phpdocumentor .phpdocumentor-element__name { + margin-bottom: var(--spacing-md); + } +} + +.phpdocumentor-element__package, +.phpdocumentor-element__extends, +.phpdocumentor-element__implements { + display: block; + font-size: var(--text-xxs); + font-weight: normal; + opacity: .7; +} + +.phpdocumentor-element__package .phpdocumentor-breadcrumbs { + display: inline; +} +.phpdocumentor .phpdocumentor-signature { + display: block; + font-size: var(--text-sm); + border: 1px solid #f0f0f0; +} + +.phpdocumentor .phpdocumentor-signature.-deprecated .phpdocumentor-signature__name { + text-decoration: line-through; +} + +@media (min-width: 550px) { + .phpdocumentor .phpdocumentor-signature { + margin-left: calc(var(--spacing-xl) * -1); + width: calc(100% + var(--spacing-xl)); + } +} + +.phpdocumentor-table-of-contents { +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry { + margin-bottom: var(--spacing-xxs); + margin-left: 2rem; + display: flex; +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry > a { + flex: 0 1 auto; +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry > a.-deprecated { + text-decoration: line-through; +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry > span { + flex: 1; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry:after { + content: ''; + height: 12px; + width: 12px; + left: 16px; + position: absolute; +} +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-private:after { + background: url('data:image/svg+xml;utf8,') no-repeat; +} +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-protected:after { + left: 13px; + background: url('data:image/svg+xml;utf8,') no-repeat; +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry:before { + width: 1.25rem; + height: 1.25rem; + line-height: 1.25rem; + background: transparent url('data:image/svg+xml;utf8,') no-repeat center center; + content: ''; + position: absolute; + left: 0; + border-radius: 50%; + font-weight: 600; + color: white; + text-align: center; + font-size: .75rem; + margin-top: .2rem; +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-method:before { + content: 'M'; + color: ''; + background-image: url('data:image/svg+xml;utf8,'); +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-function:before { + content: 'M'; + color: ' 36'; + background-image: url('data:image/svg+xml;utf8,'); +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-property:before { + content: 'P' +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-constant:before { + content: 'C'; + background-color: transparent; + background-image: url('data:image/svg+xml;utf8,'); +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-class:before { + content: 'C' +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-interface:before { + content: 'I' +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-trait:before { + content: 'T' +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-namespace:before { + content: 'N' +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-package:before { + content: 'P' +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-enum:before { + content: 'E' +} + +.phpdocumentor-table-of-contents dd { + font-style: italic; + margin-left: 2rem; +} +.phpdocumentor-element-found-in { + display: none; +} + +@media (min-width: 550px) { + .phpdocumentor-element-found-in { + display: block; + font-size: var(--text-sm); + color: gray; + margin-bottom: 1rem; + } +} + +@media (min-width: 1200px) { + .phpdocumentor-element-found-in { + position: absolute; + top: var(--spacing-sm); + right: var(--spacing-sm); + font-size: var(--text-sm); + margin-bottom: 0; + } +} + +.phpdocumentor-element-found-in .phpdocumentor-element-found-in__source { + flex: 0 1 auto; + display: inline-flex; +} + +.phpdocumentor-element-found-in .phpdocumentor-element-found-in__source:after { + width: 1.25rem; + height: 1.25rem; + line-height: 1.25rem; + background: transparent url('data:image/svg+xml;utf8,') no-repeat center center; + content: ''; + left: 0; + border-radius: 50%; + font-weight: 600; + text-align: center; + font-size: .75rem; + margin-top: .2rem; +} +.phpdocumentor-class-graph { + width: 100%; height: 600px; border:1px solid black; overflow: hidden +} + +.phpdocumentor-class-graph__graph { + width: 100%; +} +.phpdocumentor-tag-list__definition { + display: flex; +} + +.phpdocumentor-tag-link { + margin-right: var(--spacing-sm); +} +aside.phpdocumentor-sidebar +{ + display: flex; + flex-direction: column; +} + +aside.phpdocumentor-sidebar + section.-documentation +{ + order: 1; +} + +aside.phpdocumentor-sidebar + section.-packages +{ + order: 2; +} + +aside.phpdocumentor-sidebar + section.-namespaces +{ + order: 3; +} + +aside.phpdocumentor-sidebar + section.-reports +{ + order: 4; +} + +aside.phpdocumentor-sidebar + section.-indices +{ + order: 5; +} + +aside.phpdocumentor-sidebar + ul.phpdocumentor-list +{ + padding: 0 var(--spacing-md) !important; +} + +p > code, +li > code, +code.prettyprint +{ + background-color: var(--code-background-color); + border: 1px solid #f0f0f0; + border-radius: var(--border-radius-base-size); + box-sizing: border-box; + font-size: var(--text-sm); + padding: var(--spacing-xxxs); +} + +@media (max-width: 999px) { +div.admonition-wrapper +{ + display: none; +} +} + +@media (min-width: 1000px) { +div.admonition-wrapper +{ + display: block; + float: right; + padding: var(--spacing-md); + margin: 0 0 var(--spacing-md) var(--spacing-md); + width: auto; + font-size: var(--text-sm); + border: 1px solid var(--primary-color-lighten); +} +} + +div.admonition-wrapper + p.sidebar-title +{ + font-weight: bold; +} + +div.contents + ul.phpdocumentor-list +{ + margin-bottom: 0; +} + +div.phpdocumentor-content + div.section + ul +{ + padding-left: var(--spacing-lg); +} + +div.phpdocumentor-content + div.section + ul + li +{ + padding-bottom: 0; +} + + +dl.phpdocumentor-table-of-contents + dt.phpdocumentor-table-of-contents__entry.-documentation:before +{ + content: 'D'; +} + +h2.phpdocumentor-content__title +{ + display: flex; + flex-direction: column; +} + +h2.phpdocumentor-content__title + div.phpdocumentor-element__package +{ + order: 1; +} + +h2.phpdocumentor-content__title + span.phpdocumentor-element__extends, +h2.phpdocumentor-content__title + span.phpdocumentor-element__implements +{ + font-size: calc(var(--text-xxs) / 1.2 / 1.2); + order: 2; +} + +h2.phpdocumentor-content__title + span:first-letter +{ + text-transform: lowercase; +} diff --git a/doc/files/src-abstractmiddleware.html b/doc/files/src-abstractmiddleware.html new file mode 100644 index 0000000..b3e8ee3 --- /dev/null +++ b/doc/files/src-abstractmiddleware.html @@ -0,0 +1,347 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + +
        +

        PSR-15 Queue

        + + + + + + +
        + +
        +
        + + + + +
        +
        +
          +
        + +
        +

        AbstractMiddleware.php

        + +

        Queue-based PSR-15 HTTP Server Request Handler +Copyright (C) 2023 Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>

        + + +

        This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version.

        +

        This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details.

        +

        You should have received a copy of the GNU General Public License +along with this program. If not, see http://www.gnu.org/licenses/.

        +
        + + + + + + + +

        + Table of Contents + + +

        + + + + +

        + Classes + + +

        +
        +
        AbstractMiddleware
        Abstract class implementing \Psr\Http\Server\MiddlewareInterface.
        + + + + + + + + + + + + + +
        +
        +
        +
        +
        
        +        
        + +
        +
        + + + +
        +
        +
        + +
        + On this page + +
          +
        • Table Of Contents
        • +
        • + +
        • + + +
        +
        + +
        +
        +
        +
        +
        +

        Search results

        + +
        +
        +
          +
          +
          +
          +
          + + +
          + + + + + + + + diff --git a/doc/files/src-middlewarequeue.html b/doc/files/src-middlewarequeue.html new file mode 100644 index 0000000..867bb32 --- /dev/null +++ b/doc/files/src-middlewarequeue.html @@ -0,0 +1,347 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + +
          +

          PSR-15 Queue

          + + + + + + +
          + +
          +
          + + + + +
          +
          +
            +
          + +
          +

          MiddlewareQueue.php

          + +

          Queue-based PSR-15 HTTP Server Request Handler +Copyright (C) 2023 Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>

          + + +

          This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version.

          +

          This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details.

          +

          You should have received a copy of the GNU General Public License +along with this program. If not, see http://www.gnu.org/licenses/.

          +
          + + + + + + + +

          + Table of Contents + + +

          + + + + +

          + Classes + + +

          +
          +
          MiddlewareQueue
          Queue of PSR-15 Middlewares to process HTTP Server Requests.
          + + + + + + + + + + + + + +
          +
          +
          +
          +
          
          +        
          + +
          +
          + + + +
          +
          +
          + +
          + On this page + +
            +
          • Table Of Contents
          • +
          • + +
          • + + +
          +
          + +
          +
          +
          +
          +
          +

          Search results

          + +
          +
          +
            +
            +
            +
            +
            + + +
            + + + + + + + + diff --git a/doc/files/src-queuerequesthandler.html b/doc/files/src-queuerequesthandler.html new file mode 100644 index 0000000..2436524 --- /dev/null +++ b/doc/files/src-queuerequesthandler.html @@ -0,0 +1,347 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + +
            +

            PSR-15 Queue

            + + + + + + +
            + +
            +
            + + + + +
            +
            +
              +
            + +
            +

            QueueRequestHandler.php

            + +

            Queue-based PSR-15 HTTP Server Request Handler +Copyright (C) 2023 Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>

            + + +

            This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version.

            +

            This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details.

            +

            You should have received a copy of the GNU General Public License +along with this program. If not, see http://www.gnu.org/licenses/.

            +
            + + + + + + + +

            + Table of Contents + + +

            + + + + +

            + Classes + + +

            +
            +
            QueueRequestHandler
            A queue-based PSR-15 HTTP Server Request Handler.
            + + + + + + + + + + + + + +
            +
            +
            +
            +
            
            +        
            + +
            +
            + + + +
            +
            +
            + +
            + On this page + +
              +
            • Table Of Contents
            • +
            • + +
            • + + +
            +
            + +
            +
            +
            +
            +
            +

            Search results

            + +
            +
            +
              +
              +
              +
              +
              + + +
              + + + + + + + + diff --git a/doc/files/src/AbstractMiddleware.php.txt b/doc/files/src/AbstractMiddleware.php.txt new file mode 100644 index 0000000..6577645 --- /dev/null +++ b/doc/files/src/AbstractMiddleware.php.txt @@ -0,0 +1,109 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +declare(strict_types=1); + +namespace OCC\PSR15; + +use Psr\Http\Message\ResponseInterface as Response; +use Psr\Http\Message\ServerRequestInterface as ServerRequest; +use Psr\Http\Server\MiddlewareInterface; +use Psr\Http\Server\RequestHandlerInterface as RequestHandler; + +/** + * Abstract class implementing \Psr\Http\Server\MiddlewareInterface. + * + * @author Sebastian Meyer + * @package PSR15 + */ +abstract class AbstractMiddleware implements MiddlewareInterface +{ + /** + * The PSR-15 Server Request Handler. + * + * @var QueueRequestHandler + * + * @internal + */ + protected QueueRequestHandler $requestHandler; + + /** + * Process an incoming server request and produce a response. + * + * @param ServerRequest $request The server request to process + * @param RequestHandler $handler The request handler to delegate to + * + * @return Response The response object + * + * @api + */ + final public function process(ServerRequest $request, RequestHandler $handler): Response + { + /** @var QueueRequestHandler $handler */ + $this->requestHandler = $handler; + // Manipulate request if necessary. + $request = $this->processRequest($request); + // Delegate request to next middleware and get response. + $response = $handler->handle($request); + // Manipulate response if necessary. + $response = $this->processResponse($response); + // Return response to previous middleware. + return $response; + } + + /** + * Process an incoming server request before delegating to next middleware. + * + * @param ServerRequest $request The incoming server request + * + * @return ServerRequest The processed server request + */ + protected function processRequest(ServerRequest $request): ServerRequest + { + return $request; + } + + /** + * Process an incoming response before returning it to previous middleware. + * + * @param Response $response The incoming response + * + * @return Response The processed response + */ + protected function processResponse(Response $response): Response + { + return $response; + } + + /** + * Allow the middleware to be invoked directly. + * + * @param ServerRequest $request The server request to process + * @param RequestHandler $handler The request handler to delegate to + * + * @return Response The response object + * + * @api + */ + final public function __invoke(ServerRequest $request, RequestHandler $handler): Response + { + return $this->process($request, $handler); + } +} diff --git a/doc/files/src/MiddlewareQueue.php.txt b/doc/files/src/MiddlewareQueue.php.txt new file mode 100644 index 0000000..ed89621 --- /dev/null +++ b/doc/files/src/MiddlewareQueue.php.txt @@ -0,0 +1,55 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +declare(strict_types=1); + +namespace OCC\PSR15; + +use OCC\Basics\DataStructures\StrictQueue; +use OCC\Basics\Traits\Singleton; +use Psr\Http\Server\MiddlewareInterface as Middleware; + +/** + * Queue of PSR-15 Middlewares to process HTTP Server Requests. + * + * @author Sebastian Meyer + * @package PSR15 + * + * @method static static getInstance(iterable<\Psr\Http\Server\MiddlewareInterface> $middlewares) + * + * @extends StrictQueue + */ +class MiddlewareQueue extends StrictQueue +{ + use Singleton; + + /** + * Create a queue of PSR-15 compatible middlewares. + * + * @param iterable $middlewares Initial set of PSR-15 middlewares + * + * @return void + */ + private function __construct(iterable $middlewares = []) + { + parent::__construct([Middleware::class]); + $this->append(...$middlewares); + } +} diff --git a/doc/files/src/QueueRequestHandler.php.txt b/doc/files/src/QueueRequestHandler.php.txt new file mode 100644 index 0000000..e29a280 --- /dev/null +++ b/doc/files/src/QueueRequestHandler.php.txt @@ -0,0 +1,236 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +declare(strict_types=1); + +namespace OCC\PSR15; + +use Exception; +use RuntimeException; +use GuzzleHttp\Psr7\Response as GuzzleResponse; +use GuzzleHttp\Psr7\ServerRequest as GuzzleRequest; +use OCC\Basics\Traits\Getter; +use Psr\Http\Message\ResponseInterface as Response; +use Psr\Http\Message\ServerRequestInterface as ServerRequest; +use Psr\Http\Server\MiddlewareInterface as Middleware; +use Psr\Http\Server\RequestHandlerInterface as RequestHandler; + +use function array_keys; +use function count; +use function filter_var; +use function get_debug_type; +use function header; +use function headers_sent; +use function is_null; +use function sprintf; + +/** + * A queue-based PSR-15 HTTP Server Request Handler. + * + * @author Sebastian Meyer + * @package PSR15 + * + * @property-read MiddlewareQueue $queue + * @property-read ServerRequest $request + * @property-read Response $response + */ +class QueueRequestHandler implements RequestHandler +{ + use Getter; + + /** + * The PSR-7 HTTP Server Request. + * + * @var ServerRequest + * + * @internal + */ + protected ServerRequest $request; + + /** + * The queue of middlewares to process the server request. + * + * @var MiddlewareQueue + * + * @internal + */ + protected MiddlewareQueue $queue; + + /** + * The PSR-7 HTTP Response. + * + * @var Response + * + * @internal + */ + protected Response $response; + + /** + * Handles a request by invoking a queue of middlewares. + * + * @param ?ServerRequest $request The PSR-7 server request to handle + * + * @return Response A PSR-7 compatible HTTP response + * + * @api + */ + public function handle(?ServerRequest $request = null): Response + { + $this->request = $request ?? $this->request; + if (count($this->queue) > 0) { + $middleware = $this->queue->dequeue(); + // It is RECOMMENDED that any application using middleware includes a + // component that catches exceptions and converts them into responses. + // This middleware SHOULD be the first component executed and wrap all + // further processing to ensure that a response is always generated. + try { + $this->response = $middleware->process($this->request, $this); + } catch (Exception $exception) { + $options = [ + 'options' => [ + 'default' => 500, + 'min_range' => 100, + 'max_range' => 599 + ] + ]; + $statusCode = filter_var($exception->getCode(), FILTER_VALIDATE_INT, $options); + $this->response = new GuzzleResponse( + $statusCode, + [], + sprintf( + 'Exception thrown in middleware %s: %s', + get_debug_type($middleware), + $exception->getMessage() + ) + ); + $this->respond(1); + } + } + return $this->response; + } + + /** + * Return the current response to the client. + * + * @param ?int $exitCode Exit code after sending out the response or NULL to continue + * + * @return void + * + * @throws RuntimeException if headers were already sent + * + * @api + */ + public function respond(?int $exitCode = null): void + { + $file = 'unknown file'; + $line = 0; + if (headers_sent($file, $line)) { + throw new RuntimeException( + sprintf( + 'Headers already sent in %s on line %d', + $file, + $line + ) + ); + } + header( + sprintf( + 'HTTP/%s %d %s', + $this->response->getProtocolVersion(), + $this->response->getStatusCode(), + $this->response->getReasonPhrase() + ), + true + ); + foreach (array_keys($this->response->getHeaders()) as $name) { + /** @var string $name */ + $header = sprintf('%s: %s', $name, $this->response->getHeaderLine($name)); + header($header, false); + } + echo $this->response->getBody(); + if (!is_null($exitCode)) { + exit($exitCode); + } + } + + /** + * Magic getter method for $this->queue. + * + * @return MiddlewareQueue The queue of PSR-15 middlewares + * + * @internal + */ + protected function _magicGetQueue(): MiddlewareQueue + { + return $this->queue; + } + + /** + * Magic getter method for $this->request. + * + * @return ServerRequest The PSR-7 server request + * + * @internal + */ + protected function _magicGetRequest(): ServerRequest + { + return $this->request; + } + + /** + * Magic getter method for $this->response. + * + * @return Response The PSR-7 response + * + * @internal + */ + protected function _magicGetResponse(): Response + { + return $this->response; + } + + /** + * Create a queue-based PSR-15 HTTP Server Request Handler. + * + * @param iterable $middlewares Initial set of middlewares + * + * @return void + */ + public function __construct(iterable $middlewares = []) + { + $this->request = GuzzleRequest::fromGlobals(); + $this->queue = MiddlewareQueue::getInstance($middlewares); + $this->response = new GuzzleResponse(200); + } + + /** + * Allow the request handler to be invoked directly. + * + * @param ?ServerRequest $request The PSR-7 server request to handle + * + * @return Response A PSR-7 compatible HTTP response + * + * @api + */ + public function __invoke(?ServerRequest $request = null): Response + { + return $this->handle($request); + } +} diff --git a/doc/graphs/classes.html b/doc/graphs/classes.html new file mode 100644 index 0000000..f338df8 --- /dev/null +++ b/doc/graphs/classes.html @@ -0,0 +1,176 @@ + + + + + PSR-15 Queue + + + + + + + + + +
              +

              PSR-15 Queue

              + + + + + + +
              + +
              +
              + + + + +
              +
              + +
              + +
              +
              +
              +
              +

              Search results

              + +
              +
              +
                +
                +
                +
                +
                + + +
                + + + + + + + + diff --git a/doc/guides/changelog.html b/doc/guides/changelog.html new file mode 100644 index 0000000..ff7ad4b --- /dev/null +++ b/doc/guides/changelog.html @@ -0,0 +1,274 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + + +
                +

                PSR-15 Queue

                + + + + + + +
                + +
                +
                + + + + +
                +
                +

                Changelog

                + +
                +
                +
                + +
                + +
                +
                + +
                +

                v1.1.0

                + + +

                New Features: +

                + + + + + + +

                Minor Changes: +

                + + + +
                  +
                • Added Composer commands for development tools (PHP_CodeSniffer, PHP-CS-Fixer, PHPStan, Psalm and phpDocumentor)
                • + +
                + + +

                Maintencance: +

                + + + +
                  +
                • Updated dependencies
                • + +
                + +
                + +
                +

                v1.0.1

                + + +

                Maintenance: +

                + + + +
                  +
                • Updated dependencies
                • + +
                + +
                + +
                +

                v1.0.0

                + + +

                Initial Release +

                + +
                + +
                + +
                +
                +
                +
                +

                Search results

                + +
                +
                +
                  +
                  +
                  +
                  +
                  + + +
                  + + + + + + + + diff --git a/doc/guides/index.html b/doc/guides/index.html new file mode 100644 index 0000000..7405720 --- /dev/null +++ b/doc/guides/index.html @@ -0,0 +1,263 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + + +
                  +

                  PSR-15 Queue

                  + + + + + + +
                  + +
                  +
                  + + + + +
                  +
                  +

                  Documentation

                  + +
                  + +
                  + +
                  + +
                  +
                  +
                  +
                  +

                  Search results

                  + +
                  +
                  +
                    +
                    +
                    +
                    +
                    + + +
                    + + + + + + + + diff --git a/doc/guides/overview/abstractmiddleware.html b/doc/guides/overview/abstractmiddleware.html new file mode 100644 index 0000000..c01576c --- /dev/null +++ b/doc/guides/overview/abstractmiddleware.html @@ -0,0 +1,183 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + + +
                    +

                    PSR-15 Queue

                    + + + + + + +
                    + +
                    +
                    + + + + +
                    +
                    +

                    AbstractMiddleware

                    + +
                    + +
                    +
                    +
                    +
                    +

                    Search results

                    + +
                    +
                    +
                      +
                      +
                      +
                      +
                      + + +
                      + + + + + + + + diff --git a/doc/guides/overview/index.html b/doc/guides/overview/index.html new file mode 100644 index 0000000..4d904a4 --- /dev/null +++ b/doc/guides/overview/index.html @@ -0,0 +1,219 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + + +
                      +

                      PSR-15 Queue

                      + + + + + + +
                      + +
                      +
                      + + + + +
                      +
                      +

                      Overview

                      + + +

                      The package contains an implementation of PSR-15: HTTP Server Request Handlers +in a queue-based variant. A QueueRequestHandler handles an incoming HTTP request by passing it through a queue +of one or more middlewares. The MiddlewareQueue provides the middlewares in first-in, first-out (FIFO) order, +i.e. the HTTP request is passed from middleware to middleware preserving the order in which the middlewares were added +to the queue. An AbstractMiddleware helps developing your own middlewares, but you can also use any middleware +implementing the Psr\Http\Server\MiddlewareInterface.

                      + + +

                      All files share the highest coding standards of PHPStan and Psalm, +and full PSR-12 compliance to make sure they can be combined and easily used +in other projects.

                      + +
                      + +
                      + +
                      + +
                      +
                      +
                      +
                      +

                      Search results

                      + +
                      +
                      +
                        +
                        +
                        +
                        +
                        + + +
                        + + + + + + + + diff --git a/doc/guides/overview/middlewarequeue.html b/doc/guides/overview/middlewarequeue.html new file mode 100644 index 0000000..ce182b3 --- /dev/null +++ b/doc/guides/overview/middlewarequeue.html @@ -0,0 +1,183 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + + +
                        +

                        PSR-15 Queue

                        + + + + + + +
                        + +
                        +
                        + + + + +
                        +
                        +

                        MiddlewareQueue

                        + +
                        + +
                        +
                        +
                        +
                        +

                        Search results

                        + +
                        +
                        +
                          +
                          +
                          +
                          +
                          + + +
                          + + + + + + + + diff --git a/doc/guides/overview/queuerequesthandler.html b/doc/guides/overview/queuerequesthandler.html new file mode 100644 index 0000000..8eee82c --- /dev/null +++ b/doc/guides/overview/queuerequesthandler.html @@ -0,0 +1,183 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + + +
                          +

                          PSR-15 Queue

                          + + + + + + +
                          + +
                          +
                          + + + + +
                          +
                          +

                          QueueRequestHandler

                          + +
                          + +
                          +
                          +
                          +
                          +

                          Search results

                          + +
                          +
                          +
                            +
                            +
                            +
                            +
                            + + +
                            + + + + + + + + diff --git a/doc/guides/usage/index.html b/doc/guides/usage/index.html new file mode 100644 index 0000000..b70da21 --- /dev/null +++ b/doc/guides/usage/index.html @@ -0,0 +1,263 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + + +
                            +

                            PSR-15 Queue

                            + + + + + + +
                            + +
                            +
                            + + + + +
                            +
                            +

                            User Guide

                            + + +

                            The Queue-based HTTP Server Request Handler + is a library package, not a stand-alone application. The following +documentation of requirements and installation procedures describes how to make use of the classes within your own +application. For a detailed description of the package's contents have a look at the Overview page.

                            + +
                            + +
                            + +
                            + +
                            +
                            +
                            +
                            +

                            Search results

                            + +
                            +
                            +
                              +
                              +
                              +
                              +
                              + + +
                              + + + + + + + + diff --git a/doc/guides/usage/installation.html b/doc/guides/usage/installation.html new file mode 100644 index 0000000..e3c095e --- /dev/null +++ b/doc/guides/usage/installation.html @@ -0,0 +1,268 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + + +
                              +

                              PSR-15 Queue

                              + + + + + + +
                              + +
                              +
                              + + + + +
                              +
                              +

                              Installation

                              + +
                              +
                              +
                              + +
                              + +
                              +
                              + +
                              +

                              Composer

                              + + +

                              The intended and recommended way of re-using this package is via Composer. The following +command will get you the latest version and make it a dependency of your project. It will also request all dependencies +and register all classes with the autoloader to make them available inside the application.

                              + +
                              # This will install the latest stable version suitable for your project
                              +composer require "opencultureconsulting/psr15"
                              + + +

                              If you want to use a specific version other than the latest available for your environment, you can do so by appending +the desired version constraint:

                              + +
                              # This will install the latest patch level version of 1.1 (i. e. >=1.1.0 && <1.2.0)
                              +composer require "opencultureconsulting/psr15:~1.1"
                              + + +

                              All available versions as well as further information about Requirements and dependencies can be found on +Packagist.

                              + +
                              + +
                              +

                              Git

                              + + +

                              Alternatively, you can fetch the files from GitHub and add them to +your project manually. The best way is by cloning the repository, because then you can easily update to a newer version +by just pulling the changes and checking out a different version tag.

                              + +
                              # This will clone the repository into the "psr15" directory
                              +git clone https://github.com/opencultureconsulting/psr-15.git psr15
                              + + +

                              If you want to use a specific version other than the latest development state, you have to specify the desired tag as +well:

                              + +
                              # This will clone the repository state at version "1.1.0" into the "psr15" directory
                              +git clone --branch=v1.1.0 https://github.com/opencultureconsulting/psr-15.git psr15
                              + + +

                              Be aware that you also need to make the classes available in your application by either adding them to your autoloader +or by including all files individually in PHP. Also don't forget to do the same for all Requirements.

                              + +
                              + +
                              +

                              Download

                              + + +

                              As a last resort you can also just download the files. You can find all available versions as well as the current +development state on the GitHub release page.

                              + +
                              + +
                              + +
                              +
                              +
                              +
                              +

                              Search results

                              + +
                              +
                              +
                                +
                                +
                                +
                                +
                                + + +
                                + + + + + + + + diff --git a/doc/guides/usage/requirements.html b/doc/guides/usage/requirements.html new file mode 100644 index 0000000..8aa4324 --- /dev/null +++ b/doc/guides/usage/requirements.html @@ -0,0 +1,216 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + + +
                                +

                                PSR-15 Queue

                                + + + + + + +
                                + +
                                +
                                + + + + +
                                +
                                +

                                Requirements

                                + +
                                +

                                Environment

                                + + +

                                This package requires at least PHP 8.1 +.

                                + + +

                                It is highly recommended to use Composer for dependency management and autoloading, +although it is technically not strictly required for using any of these classes. But it certainly makes it a lot +easier!

                                + +
                                + +
                                +

                                Dependencies

                                + + +

                                This package obviously depends on psr/http-server-handler +and psr/http-server-middleware which define the standard +PSR-15: HTTP Server Request Handlers interfaces.

                                + + +

                                It uses the PSR-7: HTTP Message implementations for server request and response +of the great guzzlehttp/psr7 library.

                                + + +

                                The middleware queue is based on a StrictQueue +of the opencultureconsulting/basics package which also +provides some useful traits.

                                + +
                                + +
                                + +
                                +
                                +
                                +
                                +

                                Search results

                                + +
                                +
                                +
                                  +
                                  +
                                  +
                                  +
                                  + + +
                                  + + + + + + + + diff --git a/doc/guides/usage/usage.html b/doc/guides/usage/usage.html new file mode 100644 index 0000000..a1b3555 --- /dev/null +++ b/doc/guides/usage/usage.html @@ -0,0 +1,397 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + + +
                                  +

                                  PSR-15 Queue

                                  + + + + + + +
                                  + +
                                  +
                                  + + + + +
                                  +
                                  +

                                  Usage

                                  + +
                                  +
                                  +
                                  + +
                                  + +
                                  +
                                  + + +

                                  The following example shows a very basic Queue-based HTTP Server Request Handler + using just two simple middlewares +(called MiddlewareOne + and MiddlewareTwo +).

                                  + +
                                  +

                                  Middlewares

                                  + + +

                                  First of all, we need some middlewares to process our server request. Although we could use any middleware implementing +the Psr/Http/Server/MiddlewareInterface + (e.g. from this great collection), we +will write our own using the AbstractMiddleware provided by this package.

                                  + + +

                                  The abstract middleware already implements a complete middleware, but it will just pass requests through without doing +anything. In order to have it do something, we need to implement our own AbstractMiddleware::processRequest() + +or AbstractMiddleware::processResponse() + method, or both of them.

                                  + + +

                                  The logic here is the same as with every PSR-15: HTTP Server Request Handler +middleware: The request gets passed through all middlewares' processRequest() + methods in order of their addition to +the queue, then a response is created and passed through all processResponse() + methods, but in reverse order +! So +the first middleware in the queue gets the request first, but the response last.

                                  + + +

                                  Our first middleware is very simple and just adds an attribute to the server request.

                                  + +
                                  use OCC\PSR15\AbstractMiddleware;
                                  +use Psr\Http\Message\ServerRequestInterface as ServerRequest;
                                  +
                                  +class MiddlewareOne extends AbstractMiddleware
                                  +{
                                  +    /**
                                  +     * Process an incoming server request before delegating to next middleware.
                                  +     *
                                  +     * @param ServerRequest $request The incoming server request
                                  +     *
                                  +     * @return ServerRequest The processed server request
                                  +     */
                                  +    protected function processRequest(ServerRequest $request): ServerRequest
                                  +    {
                                  +        // Let's just add a new attribute to the request to later check
                                  +        // which middleware was passed last.
                                  +        return $request->withAttribute('LastMiddlewarePassed', 'MiddlewareOne');
                                  +    }
                                  +}
                                  + + +

                                  For a queue to make sense we need at least a second middleware, so let's create another one. Again, we will add an +attribute to the request, but with the same name. So, whichever middleware handles the request last overwrites the +attribute with its value. This way we can later check if our middlewares were passed in the correct order.

                                  + +
                                  use OCC\PSR15\AbstractMiddleware;
                                  +use Psr\Http\Message\ServerRequestInterface as ServerRequest;
                                  +
                                  +class MiddlewareTwo extends AbstractMiddleware
                                  +{
                                  +    /**
                                  +     * Process an incoming server request before delegating to next middleware.
                                  +     *
                                  +     * @param ServerRequest $request The incoming server request
                                  +     *
                                  +     * @return ServerRequest The processed server request
                                  +     */
                                  +    protected function processRequest(ServerRequest $request): ServerRequest
                                  +    {
                                  +        // We add the same request attribute as in MiddlewareOne, effectively
                                  +        // overwriting its value.
                                  +        return $request->withAttribute('LastMiddlewarePassed', 'MiddlewareTwo');
                                  +    }
                                  +}
                                  + + +

                                  Also, we want to set the status code of the response according to the final value of our request attribute. Therefore, +we need to implement processResponse() + as well. We can do that in either one of our middlewares because it's the only +response manipulation in our example, so the order of processing doesn't make a difference (remember: MiddlewareTwo + +gets to handle the response before MiddlewareOne +). Let's go with MiddlewareTwo +.

                                  + +
                                  use OCC\PSR15\AbstractMiddleware;
                                  +use Psr\Http\Message\ResponseInterface as Response;
                                  +use Psr\Http\Message\ServerRequestInterface as ServerRequest;
                                  +
                                  +class MiddlewareTwo extends AbstractMiddleware
                                  +{
                                  +    // MiddlewareTwo::processRequest() remains unchanged (see above).
                                  +
                                  +    /**
                                  +     * Process an incoming response before returning it to previous middleware.
                                  +     *
                                  +     * @param Response $response The incoming response
                                  +     *
                                  +     * @return Response The processed response
                                  +     */
                                  +    protected function processResponse(Response $response): Response
                                  +    {
                                  +        // First we need to get the request attribute.
                                  +        $lastMiddlewarePassed = $this->requestHandler->request->getAttribute('LastMiddlewarePassed');
                                  +        if ($lastMiddlewarePassed === 'MiddlewareTwo') {
                                  +            // Great, MiddlewareTwo was passed after MiddlewareOne,
                                  +            // let's return status code 200!
                                  +            return $response->withStatus(200);
                                  +        } else {
                                  +            // Oh no, something went wrong! We'll send status code 500.
                                  +            return $response->withStatus(500);
                                  +        }
                                  +    }
                                  +}
                                  + + +

                                  Well done! We now have two middlewares.

                                  + +
                                  + +
                                  +

                                  Request Handler

                                  + + +

                                  Let's use a QueueRequestHandler to pass a server request through both of our middlewares in the +correct order.

                                  + +
                                  use OCC\PSR15\QueueRequestHandler;
                                  +
                                  +// First of all, we instantiate the request handler.
                                  +// At this point we could already provide an array of middlewares as argument and
                                  +// skip the next step, but then we wouldn't learn how to use the MiddlewareQueue.
                                  +$requestHandler = new QueueRequestHandler();
                                  +
                                  +// We can access the MiddlewareQueue as a property of the request handler.
                                  +// Let's add both of our middlewares, MiddlewareOne and MiddlewareTwo. Since
                                  +// this is a FIFO queue, the order is very important!
                                  +$requestHandler->queue->enqueue(new MiddlewareOne());
                                  +$requestHandler->queue->enqueue(new MiddlewareTwo());
                                  +
                                  +// And we are ready to handle incoming requests!
                                  +// We don't even need to pass the server request to this method, because
                                  +// the constructor already took care of that!
                                  +$finalResponse = $requestHandler->handle();
                                  +
                                  +// Now we can pass the final response back to our application.
                                  +// Alternatively, we can also return it directly to the client.
                                  +$requestHandler->respond();
                                  +
                                  +// If we did everything right, the client should now receive an HTTP response
                                  +// with status code 200 (OK).
                                  + + +

                                  And that's it!

                                  + +
                                  + +
                                  +

                                  Diving Deeper

                                  + + +

                                  To familiarize yourself with the FIFO principle of the middleware queue, you can try to exchange the two lines adding +the middlewares to the queue, i.e. adding MiddlewareTwo + first and MiddlewareOne + second. This will result in an HTTP +response with status code 500 (Internal Server Error) +.

                                  + + +

                                  This is exactly what we intended: Have a look at MiddlewareTwo::processResponse() + again! If $lastMiddlewarePassed + +is not MiddlewareTwo + (which it isn't when MiddlewareOne + is added to the queue after MiddlewareTwo +), we set the +response status code to 500 +.

                                  + +
                                  + +
                                  + +
                                  +
                                  +
                                  +
                                  +

                                  Search results

                                  + +
                                  +
                                  +
                                    +
                                    +
                                    +
                                    +
                                    + + +
                                    + + + + + + + + diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 0000000..d697d4e --- /dev/null +++ b/doc/index.html @@ -0,0 +1,230 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + +
                                    +

                                    PSR-15 Queue

                                    + + + + + + +
                                    + +
                                    +
                                    + + + + +
                                    +
                                    + + +

                                    Queue-based HTTP Server Request Handler

                                    + +

                                    An implementation of PSR-15: HTTP + Server Request Handlers.

                                    + +

                                    The PHP Standard Recommendation PSR-15 defines interfaces for server request handlers and proposes a queue-based + implementation using different middlewares for processing requests and preparing responses. This package follows + those guidelines and provides a HTTP server request handler + implementation using a middleware queue. It also contains an + abstract class for middlewares to ease the process of writing + your own middleware, but you can just as well use any middleware that implements the middleware interface specified + by PSR-15 (e.g. from the awesome PSR-15 HTTP Middlewares project).

                                    + +

                                    All components of this package follow the highest coding standards of PHPStan + and Psalm, and comply to PSR-12 + code style guidelines to make sure they can be combined and easily re-used in other projects.

                                    + +

                                    Table of Contents

                                    + +

                                    Documentation

                                    +
                                    +
                                    + Overview +
                                    +
                                    + QueueRequestHandler
                                    + MiddlewareQueue
                                    + AbstractMiddleware
                                    +
                                    +
                                    + User Guide +
                                    +
                                    + Requirements
                                    + Installation
                                    + Usage
                                    +
                                    +
                                    + Changelog +
                                    +
                                    +

                                    Packages

                                    +
                                    +
                                    + PSR15 +
                                    +
                                    +
                                    +
                                    +
                                    +
                                    +
                                    +

                                    Search results

                                    + +
                                    +
                                    +
                                      +
                                      +
                                      +
                                      +
                                      + + +
                                      + + + + + + + + diff --git a/doc/indices/files.html b/doc/indices/files.html new file mode 100644 index 0000000..58e240d --- /dev/null +++ b/doc/indices/files.html @@ -0,0 +1,193 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + +
                                      +

                                      PSR-15 Queue

                                      + + + + + + +
                                      + +
                                      +
                                      + + + + +
                                      +
                                      + +

                                      Files

                                      +

                                      A

                                      + +

                                      M

                                      + +

                                      Q

                                      + +
                                      +
                                      +
                                      +
                                      +
                                      +

                                      Search results

                                      + +
                                      +
                                      +
                                        +
                                        +
                                        +
                                        +
                                        + + +
                                        + + + + + + + + diff --git a/doc/js/search.js b/doc/js/search.js new file mode 100644 index 0000000..093d6d0 --- /dev/null +++ b/doc/js/search.js @@ -0,0 +1,173 @@ +// Search module for phpDocumentor +// +// This module is a wrapper around fuse.js that will use a given index and attach itself to a +// search form and to a search results pane identified by the following data attributes: +// +// 1. data-search-form +// 2. data-search-results +// +// The data-search-form is expected to have a single input element of type 'search' that will trigger searching for +// a series of results, were the data-search-results pane is expected to have a direct UL child that will be populated +// with rendered results. +// +// The search has various stages, upon loading this stage the data-search-form receives the CSS class +// 'phpdocumentor-search--enabled'; this indicates that JS is allowed and indices are being loaded. It is recommended +// to hide the form by default and show it when it receives this class to achieve progressive enhancement for this +// feature. +// +// After loading this module, it is expected to load a search index asynchronously, for example: +// +// +// +// In this script the generated index should attach itself to the search module using the `appendIndex` function. By +// doing it like this the page will continue loading, unhindered by the loading of the search. +// +// After the page has fully loaded, and all these deferred indexes loaded, the initialization of the search module will +// be called and the form will receive the class 'phpdocumentor-search--active', indicating search is ready. At this +// point, the input field will also have it's 'disabled' attribute removed. +var Search = (function () { + var fuse; + var index = []; + var options = { + shouldSort: true, + threshold: 0.6, + location: 0, + distance: 100, + maxPatternLength: 32, + minMatchCharLength: 1, + keys: [ + "fqsen", + "name", + "summary", + "url" + ] + }; + + // Credit David Walsh (https://davidwalsh.name/javascript-debounce-function) + // Returns a function, that, as long as it continues to be invoked, will not + // be triggered. The function will be called after it stops being called for + // N milliseconds. If `immediate` is passed, trigger the function on the + // leading edge, instead of the trailing. + function debounce(func, wait, immediate) { + var timeout; + + return function executedFunction() { + var context = this; + var args = arguments; + + var later = function () { + timeout = null; + if (!immediate) func.apply(context, args); + }; + + var callNow = immediate && !timeout; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + if (callNow) func.apply(context, args); + }; + } + + function close() { + // Start scroll prevention: https://css-tricks.com/prevent-page-scrolling-when-a-modal-is-open/ + const scrollY = document.body.style.top; + document.body.style.position = ''; + document.body.style.top = ''; + window.scrollTo(0, parseInt(scrollY || '0') * -1); + // End scroll prevention + + var form = document.querySelector('[data-search-form]'); + var searchResults = document.querySelector('[data-search-results]'); + + form.classList.toggle('phpdocumentor-search--has-results', false); + searchResults.classList.add('phpdocumentor-search-results--hidden'); + var searchField = document.querySelector('[data-search-form] input[type="search"]'); + searchField.blur(); + } + + function search(event) { + // Start scroll prevention: https://css-tricks.com/prevent-page-scrolling-when-a-modal-is-open/ + document.body.style.position = 'fixed'; + document.body.style.top = `-${window.scrollY}px`; + // End scroll prevention + + // prevent enter's from autosubmitting + event.stopPropagation(); + + var form = document.querySelector('[data-search-form]'); + var searchResults = document.querySelector('[data-search-results]'); + var searchResultEntries = document.querySelector('[data-search-results] .phpdocumentor-search-results__entries'); + + searchResultEntries.innerHTML = ''; + + if (!event.target.value) { + close(); + return; + } + + form.classList.toggle('phpdocumentor-search--has-results', true); + searchResults.classList.remove('phpdocumentor-search-results--hidden'); + var results = fuse.search(event.target.value, {limit: 25}); + + results.forEach(function (result) { + var entry = document.createElement("li"); + entry.classList.add("phpdocumentor-search-results__entry"); + entry.innerHTML += '

                                        ' + result.name + "

                                        \n"; + entry.innerHTML += '' + result.fqsen + "\n"; + entry.innerHTML += '
                                        ' + result.summary + '
                                        '; + searchResultEntries.appendChild(entry) + }); + } + + function appendIndex(added) { + index = index.concat(added); + + // re-initialize search engine when appending an index after initialisation + if (typeof fuse !== 'undefined') { + fuse = new Fuse(index, options); + } + } + + function init() { + fuse = new Fuse(index, options); + + var form = document.querySelector('[data-search-form]'); + var searchField = document.querySelector('[data-search-form] input[type="search"]'); + + var closeButton = document.querySelector('.phpdocumentor-search-results__close'); + closeButton.addEventListener('click', function() { close() }.bind(this)); + + var searchResults = document.querySelector('[data-search-results]'); + searchResults.addEventListener('click', function() { close() }.bind(this)); + + form.classList.add('phpdocumentor-search--active'); + + searchField.setAttribute('placeholder', 'Search (Press "/" to focus)'); + searchField.removeAttribute('disabled'); + searchField.addEventListener('keyup', debounce(search, 300)); + + window.addEventListener('keyup', function (event) { + if (event.key === '/') { + searchField.focus(); + } + if (event.code === 'Escape') { + close(); + } + }.bind(this)); + } + + return { + appendIndex, + init + } +})(); + +window.addEventListener('DOMContentLoaded', function () { + var form = document.querySelector('[data-search-form]'); + + // When JS is supported; show search box. Must be before including the search for it to take effect immediately + form.classList.add('phpdocumentor-search--enabled'); +}); + +window.addEventListener('load', function () { + Search.init(); +}); diff --git a/doc/js/searchIndex.js b/doc/js/searchIndex.js new file mode 100644 index 0000000..bf307a9 --- /dev/null +++ b/doc/js/searchIndex.js @@ -0,0 +1,79 @@ +Search.appendIndex( + [ + { + "fqsen": "\\OCC\\PSR15\\AbstractMiddleware", + "name": "AbstractMiddleware", + "summary": "Abstract\u0020class\u0020implementing\u0020\\Psr\\Http\\Server\\MiddlewareInterface.", + "url": "classes/OCC-PSR15-AbstractMiddleware.html" + }, { + "fqsen": "\\OCC\\PSR15\\AbstractMiddleware\u003A\u003Aprocess\u0028\u0029", + "name": "process", + "summary": "Process\u0020an\u0020incoming\u0020server\u0020request\u0020and\u0020produce\u0020a\u0020response.", + "url": "classes/OCC-PSR15-AbstractMiddleware.html#method_process" + }, { + "fqsen": "\\OCC\\PSR15\\AbstractMiddleware\u003A\u003AprocessRequest\u0028\u0029", + "name": "processRequest", + "summary": "Process\u0020an\u0020incoming\u0020server\u0020request\u0020before\u0020delegating\u0020to\u0020next\u0020middleware.", + "url": "classes/OCC-PSR15-AbstractMiddleware.html#method_processRequest" + }, { + "fqsen": "\\OCC\\PSR15\\AbstractMiddleware\u003A\u003AprocessResponse\u0028\u0029", + "name": "processResponse", + "summary": "Process\u0020an\u0020incoming\u0020response\u0020before\u0020returning\u0020it\u0020to\u0020previous\u0020middleware.", + "url": "classes/OCC-PSR15-AbstractMiddleware.html#method_processResponse" + }, { + "fqsen": "\\OCC\\PSR15\\AbstractMiddleware\u003A\u003A__invoke\u0028\u0029", + "name": "__invoke", + "summary": "Allow\u0020the\u0020middleware\u0020to\u0020be\u0020invoked\u0020directly.", + "url": "classes/OCC-PSR15-AbstractMiddleware.html#method___invoke" + }, { + "fqsen": "\\OCC\\PSR15\\MiddlewareQueue", + "name": "MiddlewareQueue", + "summary": "Queue\u0020of\u0020PSR\u002D15\u0020Middlewares\u0020to\u0020process\u0020HTTP\u0020Server\u0020Requests.", + "url": "classes/OCC-PSR15-MiddlewareQueue.html" + }, { + "fqsen": "\\OCC\\PSR15\\MiddlewareQueue\u003A\u003A__construct\u0028\u0029", + "name": "__construct", + "summary": "Create\u0020a\u0020queue\u0020of\u0020PSR\u002D15\u0020compatible\u0020middlewares.", + "url": "classes/OCC-PSR15-MiddlewareQueue.html#method___construct" + }, { + "fqsen": "\\OCC\\PSR15\\QueueRequestHandler", + "name": "QueueRequestHandler", + "summary": "A\u0020queue\u002Dbased\u0020PSR\u002D15\u0020HTTP\u0020Server\u0020Request\u0020Handler.", + "url": "classes/OCC-PSR15-QueueRequestHandler.html" + }, { + "fqsen": "\\OCC\\PSR15\\QueueRequestHandler\u003A\u003Ahandle\u0028\u0029", + "name": "handle", + "summary": "Handles\u0020a\u0020request\u0020by\u0020invoking\u0020a\u0020queue\u0020of\u0020middlewares.", + "url": "classes/OCC-PSR15-QueueRequestHandler.html#method_handle" + }, { + "fqsen": "\\OCC\\PSR15\\QueueRequestHandler\u003A\u003Arespond\u0028\u0029", + "name": "respond", + "summary": "Return\u0020the\u0020current\u0020response\u0020to\u0020the\u0020client.", + "url": "classes/OCC-PSR15-QueueRequestHandler.html#method_respond" + }, { + "fqsen": "\\OCC\\PSR15\\QueueRequestHandler\u003A\u003A__construct\u0028\u0029", + "name": "__construct", + "summary": "Create\u0020a\u0020queue\u002Dbased\u0020PSR\u002D15\u0020HTTP\u0020Server\u0020Request\u0020Handler.", + "url": "classes/OCC-PSR15-QueueRequestHandler.html#method___construct" + }, { + "fqsen": "\\OCC\\PSR15\\QueueRequestHandler\u003A\u003A__invoke\u0028\u0029", + "name": "__invoke", + "summary": "Allow\u0020the\u0020request\u0020handler\u0020to\u0020be\u0020invoked\u0020directly.", + "url": "classes/OCC-PSR15-QueueRequestHandler.html#method___invoke" + }, { + "fqsen": "\\", + "name": "\\", + "summary": "", + "url": "namespaces/default.html" + }, { + "fqsen": "\\OCC\\PSR15", + "name": "PSR15", + "summary": "", + "url": "namespaces/occ-psr15.html" + }, { + "fqsen": "\\OCC", + "name": "OCC", + "summary": "", + "url": "namespaces/occ.html" + } ] +); diff --git a/doc/js/template.js b/doc/js/template.js new file mode 100644 index 0000000..4938329 --- /dev/null +++ b/doc/js/template.js @@ -0,0 +1,17 @@ +(function(){ + window.addEventListener('load', () => { + const el = document.querySelector('.phpdocumentor-on-this-page__content') + if (!el) { + return; + } + + const observer = new IntersectionObserver( + ([e]) => { + e.target.classList.toggle("-stuck", e.intersectionRatio < 1); + }, + {threshold: [1]} + ); + + observer.observe(el); + }) +})(); diff --git a/doc/namespaces/default.html b/doc/namespaces/default.html new file mode 100644 index 0000000..5d23676 --- /dev/null +++ b/doc/namespaces/default.html @@ -0,0 +1,324 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + +
                                        +

                                        PSR-15 Queue

                                        + + + + + + +
                                        + +
                                        +
                                        + + + + +
                                        +
                                        +
                                          +
                                        + +
                                        +

                                        API Documentation

                                        + + +

                                        + Table of Contents + + +

                                        + + +

                                        + Namespaces + + +

                                        +
                                        +
                                        OCC
                                        +
                                        + + + + + + + + + + + + + +
                                        +
                                        +
                                        +
                                        +
                                        
                                        +        
                                        + +
                                        +
                                        + + + +
                                        +
                                        +
                                        + +
                                        + On this page + +
                                          +
                                        • Table Of Contents
                                        • +
                                        • +
                                            +
                                          +
                                        • + + +
                                        +
                                        + +
                                        +
                                        +
                                        +
                                        +
                                        +

                                        Search results

                                        + +
                                        +
                                        +
                                          +
                                          +
                                          +
                                          +
                                          + + +
                                          + + + + + + + + diff --git a/doc/namespaces/occ-psr15.html b/doc/namespaces/occ-psr15.html new file mode 100644 index 0000000..cf614d0 --- /dev/null +++ b/doc/namespaces/occ-psr15.html @@ -0,0 +1,325 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + +
                                          +

                                          PSR-15 Queue

                                          + + + + + + +
                                          + +
                                          +
                                          + + + + +
                                          +
                                          + + +
                                          +

                                          PSR15

                                          + + +

                                          + Table of Contents + + +

                                          + + + + +

                                          + Classes + + +

                                          +
                                          +
                                          AbstractMiddleware
                                          Abstract class implementing \Psr\Http\Server\MiddlewareInterface.
                                          MiddlewareQueue
                                          Queue of PSR-15 Middlewares to process HTTP Server Requests.
                                          QueueRequestHandler
                                          A queue-based PSR-15 HTTP Server Request Handler.
                                          + + + + + + + + + + + +
                                          +
                                          +
                                          +
                                          +
                                          
                                          +        
                                          + +
                                          +
                                          + + + +
                                          +
                                          +
                                          + +
                                          + On this page + +
                                            +
                                          • Table Of Contents
                                          • +
                                          • + +
                                          • + + +
                                          +
                                          + +
                                          +
                                          +
                                          +
                                          +
                                          +

                                          Search results

                                          + +
                                          +
                                          +
                                            +
                                            +
                                            +
                                            +
                                            + + +
                                            + + + + + + + + diff --git a/doc/namespaces/occ.html b/doc/namespaces/occ.html new file mode 100644 index 0000000..4d435c2 --- /dev/null +++ b/doc/namespaces/occ.html @@ -0,0 +1,324 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + +
                                            +

                                            PSR-15 Queue

                                            + + + + + + +
                                            + +
                                            +
                                            + + + + +
                                            +
                                            +
                                              +
                                            + +
                                            +

                                            OCC

                                            + + +

                                            + Table of Contents + + +

                                            + + +

                                            + Namespaces + + +

                                            +
                                            +
                                            PSR15
                                            +
                                            + + + + + + + + + + + + + +
                                            +
                                            +
                                            +
                                            +
                                            
                                            +        
                                            + +
                                            +
                                            + + + +
                                            +
                                            +
                                            + +
                                            + On this page + +
                                              +
                                            • Table Of Contents
                                            • +
                                            • +
                                                +
                                              +
                                            • + + +
                                            +
                                            + +
                                            +
                                            +
                                            +
                                            +
                                            +

                                            Search results

                                            + +
                                            +
                                            +
                                              +
                                              +
                                              +
                                              +
                                              + + +
                                              + + + + + + + + diff --git a/doc/packages/Basics.html b/doc/packages/Basics.html new file mode 100644 index 0000000..ae9119c --- /dev/null +++ b/doc/packages/Basics.html @@ -0,0 +1,302 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + +
                                              +

                                              PSR-15 Queue

                                              + + + + + + +
                                              + +
                                              +
                                              + + + + +
                                              +
                                              +
                                                +
                                              + +
                                              +

                                              Basics

                                              + + +

                                              + Table of Contents + + +

                                              + + + + + + + + + + + + + + + +
                                              +
                                              +
                                              +
                                              +
                                              
                                              +        
                                              + +
                                              +
                                              + + + +
                                              +
                                              +
                                              + +
                                              + On this page + +
                                                +
                                              • Table Of Contents
                                              • +
                                              • +
                                                  +
                                                +
                                              • + + +
                                              +
                                              + +
                                              +
                                              +
                                              +
                                              +
                                              +

                                              Search results

                                              + +
                                              +
                                              +
                                                +
                                                +
                                                +
                                                +
                                                + + +
                                                + + + + + + + + diff --git a/doc/packages/PSR-15.html b/doc/packages/PSR-15.html new file mode 100644 index 0000000..5eb9e0f --- /dev/null +++ b/doc/packages/PSR-15.html @@ -0,0 +1,309 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + +
                                                +

                                                PSR-15 Queue

                                                + + + + + + +
                                                + +
                                                +
                                                + + + + +
                                                +
                                                + + +
                                                +

                                                15

                                                + + +

                                                + Table of Contents + + +

                                                + + + + + + + + + + + + + + + +
                                                +
                                                +
                                                +
                                                +
                                                
                                                +        
                                                + +
                                                +
                                                + + + +
                                                +
                                                +
                                                + +
                                                + On this page + +
                                                  +
                                                • Table Of Contents
                                                • +
                                                • +
                                                    +
                                                  +
                                                • + + +
                                                +
                                                + +
                                                +
                                                +
                                                +
                                                +
                                                +

                                                Search results

                                                + +
                                                +
                                                +
                                                  +
                                                  +
                                                  +
                                                  +
                                                  + + +
                                                  + + + + + + + + diff --git a/doc/packages/PSR.html b/doc/packages/PSR.html new file mode 100644 index 0000000..80b6d3d --- /dev/null +++ b/doc/packages/PSR.html @@ -0,0 +1,316 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + +
                                                  +

                                                  PSR-15 Queue

                                                  + + + + + + +
                                                  + +
                                                  +
                                                  + + + + +
                                                  +
                                                  +
                                                    +
                                                  + +
                                                  +

                                                  PSR

                                                  + + +

                                                  + Table of Contents + + +

                                                  + +

                                                  + Packages + + +

                                                  +
                                                  +
                                                  15
                                                  +
                                                  + + + + + + + + + + + + + + +
                                                  +
                                                  +
                                                  +
                                                  +
                                                  
                                                  +        
                                                  + +
                                                  +
                                                  + + + +
                                                  +
                                                  +
                                                  + +
                                                  + On this page + +
                                                    +
                                                  • Table Of Contents
                                                  • +
                                                  • +
                                                      +
                                                    +
                                                  • + + +
                                                  +
                                                  + +
                                                  +
                                                  +
                                                  +
                                                  +
                                                  +

                                                  Search results

                                                  + +
                                                  +
                                                  +
                                                    +
                                                    +
                                                    +
                                                    +
                                                    + + +
                                                    + + + + + + + + diff --git a/doc/packages/PSR15.html b/doc/packages/PSR15.html new file mode 100644 index 0000000..ca90420 --- /dev/null +++ b/doc/packages/PSR15.html @@ -0,0 +1,324 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + +
                                                    +

                                                    PSR-15 Queue

                                                    + + + + + + +
                                                    + +
                                                    +
                                                    + + + + +
                                                    +
                                                    +
                                                      +
                                                    + +
                                                    +

                                                    PSR15

                                                    + + +

                                                    + Table of Contents + + +

                                                    + + + + +

                                                    + Classes + + +

                                                    +
                                                    +
                                                    AbstractMiddleware
                                                    Abstract class implementing \Psr\Http\Server\MiddlewareInterface.
                                                    MiddlewareQueue
                                                    Queue of PSR-15 Middlewares to process HTTP Server Requests.
                                                    QueueRequestHandler
                                                    A queue-based PSR-15 HTTP Server Request Handler.
                                                    + + + + + + + + + + + +
                                                    +
                                                    +
                                                    +
                                                    +
                                                    
                                                    +        
                                                    + +
                                                    +
                                                    + + + +
                                                    +
                                                    +
                                                    + +
                                                    + On this page + +
                                                      +
                                                    • Table Of Contents
                                                    • +
                                                    • + +
                                                    • + + +
                                                    +
                                                    + +
                                                    +
                                                    +
                                                    +
                                                    +
                                                    +

                                                    Search results

                                                    + +
                                                    +
                                                    +
                                                      +
                                                      +
                                                      +
                                                      +
                                                      + + +
                                                      + + + + + + + + diff --git a/doc/packages/default.html b/doc/packages/default.html new file mode 100644 index 0000000..1b9ec95 --- /dev/null +++ b/doc/packages/default.html @@ -0,0 +1,324 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + +
                                                      +

                                                      PSR-15 Queue

                                                      + + + + + + +
                                                      + +
                                                      +
                                                      + + + + +
                                                      +
                                                      +
                                                        +
                                                      + +
                                                      +

                                                      API Documentation

                                                      + + +

                                                      + Table of Contents + + +

                                                      + +

                                                      + Packages + + +

                                                      +
                                                      +
                                                      PSR15
                                                      +
                                                      + + + + + + + + + + + + + + +
                                                      +
                                                      +
                                                      +
                                                      +
                                                      
                                                      +        
                                                      + +
                                                      +
                                                      + + + +
                                                      +
                                                      +
                                                      + +
                                                      + On this page + +
                                                        +
                                                      • Table Of Contents
                                                      • +
                                                      • +
                                                          +
                                                        +
                                                      • + + +
                                                      +
                                                      + +
                                                      +
                                                      +
                                                      +
                                                      +
                                                      +

                                                      Search results

                                                      + +
                                                      +
                                                      +
                                                        +
                                                        +
                                                        +
                                                        +
                                                        + + +
                                                        + + + + + + + + diff --git a/doc/packages/opencultureconsultingpsr15.html b/doc/packages/opencultureconsultingpsr15.html new file mode 100644 index 0000000..27565a6 --- /dev/null +++ b/doc/packages/opencultureconsultingpsr15.html @@ -0,0 +1,310 @@ + + + + + PSR-15 Queue + + + + + + + + + + + + + + + + + + + + + +
                                                        +

                                                        PSR-15 Queue

                                                        + + + + + + +
                                                        + +
                                                        +
                                                        + + + + +
                                                        +
                                                        +
                                                          +
                                                        + +
                                                        +

                                                        opencultureconsultingpsr15

                                                        + + +

                                                        + Table of Contents + + +

                                                        + + + + +

                                                        + Classes + + +

                                                        +
                                                        +
                                                        AbstractMiddleware
                                                        Abstract class implementing Psr\Http\Server\MiddlewareInterface.
                                                        MiddlewareQueue
                                                        Queue of PSR-15 Middlewares to process HTTP Server Requests.
                                                        QueueRequestHandler
                                                        A queue-based PSR-15 HTTP Server Request Handler.
                                                        + + + + + + + + + + + +
                                                        +
                                                        +
                                                        +
                                                        +
                                                        
                                                        +        
                                                        + +
                                                        +
                                                        + + + +
                                                        +
                                                        +
                                                        + +
                                                        + On this page + +
                                                          +
                                                        • Table Of Contents
                                                        • +
                                                        • + +
                                                        • + + +
                                                        +
                                                        + +
                                                        +
                                                        +
                                                        +
                                                        +
                                                        +

                                                        Search results

                                                        + +
                                                        +
                                                        +
                                                          +
                                                          +
                                                          +
                                                          +
                                                          + + +
                                                          + + + + + + + + diff --git a/doc/reports/deprecated.html b/doc/reports/deprecated.html new file mode 100644 index 0000000..5a02712 --- /dev/null +++ b/doc/reports/deprecated.html @@ -0,0 +1,192 @@ + + + + + PSR-15 Queue » Deprecated elements + + + + + + + + + + + + + + + + + + + + + + +
                                                          +

                                                          PSR-15 Queue

                                                          + + + + + + +
                                                          + +
                                                          +
                                                          + + + + +
                                                          +
                                                          + + +
                                                          +

                                                          Deprecated

                                                          + + +
                                                          + No deprecated elements have been found in this project. +
                                                          +
                                                          +
                                                          +
                                                          +
                                                          +
                                                          +
                                                          +

                                                          Search results

                                                          + +
                                                          +
                                                          +
                                                            +
                                                            +
                                                            +
                                                            +
                                                            + + +
                                                            + + + + + + + + diff --git a/doc/reports/errors.html b/doc/reports/errors.html new file mode 100644 index 0000000..b6282ab --- /dev/null +++ b/doc/reports/errors.html @@ -0,0 +1,191 @@ + + + + + PSR-15 Queue » Compilation errors + + + + + + + + + + + + + + + + + + + + + + +
                                                            +

                                                            PSR-15 Queue

                                                            + + + + + + +
                                                            + +
                                                            +
                                                            + + + + +
                                                            +
                                                            + + +
                                                            +

                                                            Errors

                                                            + + +
                                                            No errors have been found in this project.
                                                            + +
                                                            +
                                                            +
                                                            +
                                                            +
                                                            +
                                                            +

                                                            Search results

                                                            + +
                                                            +
                                                            +
                                                              +
                                                              +
                                                              +
                                                              +
                                                              + + +
                                                              + + + + + + + + diff --git a/doc/reports/markers.html b/doc/reports/markers.html new file mode 100644 index 0000000..7b9dd24 --- /dev/null +++ b/doc/reports/markers.html @@ -0,0 +1,192 @@ + + + + + PSR-15 Queue » Markers + + + + + + + + + + + + + + + + + + + + + + +
                                                              +

                                                              PSR-15 Queue

                                                              + + + + + + +
                                                              + +
                                                              +
                                                              + + + + +
                                                              +
                                                              + + +
                                                              +

                                                              Markers

                                                              + +
                                                              + No markers have been found in this project. +
                                                              + +
                                                              +
                                                              +
                                                              +
                                                              +
                                                              +
                                                              +

                                                              Search results

                                                              + +
                                                              +
                                                              +
                                                                +
                                                                +
                                                                +
                                                                +
                                                                + + +
                                                                + + + + + + + +