HttpHeadersBuilder
in package
Represents a HTTP message header builder.
Table of Contents
Methods
- addHeader() : void
- Adds a header to the HTTP message.
- hasHeader() : bool
- Checks if a header is already present.
- removeHeader() : void
- Removes a header from the HTTP message.
- setHeader() : void
- Sets a header to the HTTP message.
- toHeaders() : HttpHeaders
- Create HttpHeaders instance from this builder.
Methods
addHeader()
Adds a header to the HTTP message.
public
addHeader(string $name, string $value) : void
If a header with the same name is already present, it will be appended with a new line.
Parameters
- $name : string
-
Name of the header to add.
- $value : string
-
Value to apply for this header.
hasHeader()
Checks if a header is already present.
public
hasHeader(string $name) : bool
Parameters
- $name : string
-
Name of the header.
Return values
bool —true if it is present.
removeHeader()
Removes a header from the HTTP message.
public
removeHeader(string $name) : void
Parameters
- $name : string
-
Name of the header to remove.
setHeader()
Sets a header to the HTTP message.
public
setHeader(string $name, string $value) : void
If a header with the same name is already present, it will be overwritten.
Parameters
- $name : string
-
Name of the header to set.
- $value : string
-
Value to apply for this header.
toHeaders()
Create HttpHeaders instance from this builder.
public
toHeaders() : HttpHeaders
Return values
HttpHeaders —Instance containing HTTP headers.