You are here

public function ServerRequestInterface::getAttribute in Lockr 7.3

Retrieve a single derived request attribute.

Retrieves a single derived request attribute as described in getAttributes(). If the attribute has not been previously set, returns the default value as provided.

This method obviates the need for a hasAttribute() method, as it allows specifying a default value to return if the attribute is not found.

Parameters

string $name The attribute name.:

mixed $default Default value to return if the attribute does not exist.:

Return value

mixed

See also

getAttributes()

1 method overrides ServerRequestInterface::getAttribute()
ServerRequest::getAttribute in vendor/guzzlehttp/psr7/src/ServerRequest.php
Retrieve a single derived request attribute.

File

vendor/psr/http-message/src/ServerRequestInterface.php, line 227

Class

ServerRequestInterface
Representation of an incoming, server-side HTTP request.

Namespace

Psr\Http\Message

Code

public function getAttribute($name, $default = null);