PHP Class Psr7Middlewares\Middleware\Firewall

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

Public Methods

Method Description
__construct ( array $trusted = null ) Constructor. Set the trusted ips.
__invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $next ) : Psr\Http\Message\ResponseInterface Execute the middleware.
trusted ( array $trusted ) : self Set trusted ips.
untrusted ( array $untrusted ) : self Set untrusted ips.

Method Details

__construct() public method

Constructor. Set the trusted ips.
public __construct ( array $trusted = null )
$trusted array

__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

trusted() public method

Set trusted ips.
public trusted ( array $trusted ) : self
$trusted array
return self

untrusted() public method

Set untrusted ips.
public untrusted ( array $untrusted ) : self
$untrusted array
return self