You are here

public function ServerRequest::withoutAttribute in Zircon Profile 8

Same name in this branch
  1. 8 vendor/zendframework/zend-diactoros/src/ServerRequest.php \Zend\Diactoros\ServerRequest::withoutAttribute()
  2. 8 vendor/symfony/psr-http-message-bridge/Tests/Fixtures/ServerRequest.php \Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\ServerRequest::withoutAttribute()
Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-diactoros/src/ServerRequest.php \Zend\Diactoros\ServerRequest::withoutAttribute()

Return an instance that removes the specified derived request attribute.

This method allows removing 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 removes the attribute.

Parameters

string $name The attribute name.:

Return value

self

Overrides ServerRequestInterface::withoutAttribute

See also

getAttributes()

File

vendor/zendframework/zend-diactoros/src/ServerRequest.php, line 204

Class

ServerRequest
Server-side HTTP request

Namespace

Zend\Diactoros

Code

public function withoutAttribute($attribute) {
  if (!isset($this->attributes[$attribute])) {
    return clone $this;
  }
  $new = clone $this;
  unset($new->attributes[$attribute]);
  return $new;
}