You are here

public function ServerRequest::withAttribute in Lockr 7.3

Return an instance with the specified derived request attribute.

This method allows setting a single derived request attribute as described in getAttributes().

This method MUST be implemented in such a way as to retain the immutability of the message, and MUST return an instance that has the updated attribute.

Parameters

string $name The attribute name.:

mixed $value The value of the attribute.:

Return value

static

Overrides ServerRequestInterface::withAttribute

See also

getAttributes()

File

vendor/guzzlehttp/psr7/src/ServerRequest.php, line 354

Class

ServerRequest
Server-side HTTP request

Namespace

GuzzleHttp\Psr7

Code

public function withAttribute($attribute, $value) {
  $new = clone $this;
  $new->attributes[$attribute] = $value;
  return $new;
}