PHP Class Psr7Middlewares\Middleware\Www

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

Public Methods

Method Description
__construct ( boolean $addWww = false ) Configure whether the www subdomain should be added or removed.
__invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $next ) : Psr\Http\Message\ResponseInterface Execute the middleware.

Private Methods

Method Description
canAddWww ( string $host ) : boolean Check whether the domain can add a www. subdomain.

Method Details

__construct() public method

Configure whether the www subdomain should be added or removed.
public __construct ( boolean $addWww = false )
$addWww boolean

__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