public function ServerRequestInterface::getAttribute in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/psr/http-message/src/ServerRequestInterface.php \Psr\Http\Message\ServerRequestInterface::getAttribute()
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()
2 methods override ServerRequestInterface::getAttribute()
- ServerRequest::getAttribute in vendor/
zendframework/ zend-diactoros/ src/ ServerRequest.php - Retrieve a single derived request attribute.
- ServerRequest::getAttribute in vendor/
symfony/ psr-http-message-bridge/ Tests/ Fixtures/ 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\MessageCode
public function getAttribute($name, $default = null);