Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/Middleware/MiddlewareInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,12 @@

/**
* Middlewares must take a MiddlewareInterface as their first constructor
* argument {@see Google\ApiCore\Middleware\ResponseMetadataMiddleware}, which
* represents the next middleware in the chain. This next middleware MUST be
* invoked by this MiddlewareInterface, and the result must be returned as part
* of the `__invoke` method implementation.
* argument, which represents the next middleware in the chain. This next
* middleware MUST be invoked by this MiddlewareInterface, and the result must
* be returned as part of the `__invoke` method implementation.
*
* To create your own middleware, first implement the interface, as well as pass the handler
* in through the constructor:
* To create your own middleware, first implement the interface, as well as
* pass the handler in through the constructor:
*
* ```
* use Google\ApiCore\Call;
Expand All @@ -66,15 +65,17 @@
* }
* ```
*
* Next, add the middleware to any class implementing `GapicClientTrait` by passing in a
* callable which returns the new middleware:
* Next, add the middleware to any class implementing `GapicClientTrait` by
* passing in a callable which returns the new middleware:
*
* ```
* $client = new ExampleGoogleApiServiceClient();
* $client->addMiddleware(function (MiddlewareInterface $handler) {
* return new MyTestMiddleware($handler);
* });
* ```
*
* @see Google\ApiCore\Middleware\ResponseMetadataMiddleware
*/
interface MiddlewareInterface
{
Expand Down
Loading