PHP Class Psr7Middlewares\Middleware\Uuid

Inheritance: use trait Psr7Middlewares\Utils\AttributeTrait
Show file Open project: oscarotero/psr7-middlewares

Public Methods

Method Description
__construct ( integer | null $version = null ) Constructor. Set the version of UUID.
__invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $next ) : Psr\Http\Message\ResponseInterface Execute the middleware.
getUuid ( Psr\Http\Message\ServerRequestInterface $request ) : Ramsey\Uuid\Uuid | null Returns the Uuid instance.
header ( false | string $header ) : self Set whether the Uuid is stored in the header.
version ( integer $version ) : self Choose the Uuid version.

Private Methods

Method Description
generateUuid ( ) : string Generate the uuid with the current configuration.

Method Details

__construct() public method

Constructor. Set the version of UUID.
public __construct ( integer | null $version = null )
$version integer | null

__invoke() public method

Execute the middleware.
public __invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $next ) : Psr\Http\Message\ResponseInterface
$request Psr\Http\Message\ServerRequestInterface
$response Psr\Http\Message\ResponseInterface
$next callable
return Psr\Http\Message\ResponseInterface

getUuid() public static method

Returns the Uuid instance.
public static getUuid ( Psr\Http\Message\ServerRequestInterface $request ) : Ramsey\Uuid\Uuid | null
$request Psr\Http\Message\ServerRequestInterface
return Ramsey\Uuid\Uuid | null

header() public method

Set false to do not store.
public header ( false | string $header ) : self
$header false | string
return self

version() public method

Choose the Uuid version.
public version ( integer $version ) : self
$version integer 1, 3, 4 or 5
return self