CacheControl
in package
implements
HeaderInterface
Tags
Table of Contents
Interfaces
- HeaderInterface
- Interface for HTTP Header classes.
Properties
- $directives : array<string|int, mixed>
- Array of Cache-Control directives
- $value : string
Methods
- addDirective() : $this
- Add a directive For directives like 'max-age=60', $value = '60' For directives like 'private', use the default $value = true
- fromString() : static
- Creates a CacheControl object from a headerLine
- getDirective() : string|null
- Fetch the value of a directive from the internal directive array
- getFieldName() : string
- Required from HeaderDescription interface
- getFieldValue() : string
- Assembles the directives into a comma-delimited string
- hasDirective() : bool
- Check the internal directives array for a directive
- isEmpty() : bool
- Checks if the internal directives array is empty
- removeDirective() : $this
- Remove a directive
- toString() : string
- Returns a string representation of the HTTP Cache-Control header
- match() : int
- Internal function used by parseValue to match tokens
- parseValue() : array<string|int, mixed>
- Internal function for parsing the value part of a HTTP Cache-Control header
Properties
$directives
Array of Cache-Control directives
protected
array<string|int, mixed>
$directives
= []
$value
protected
string
$value
Methods
addDirective()
Add a directive For directives like 'max-age=60', $value = '60' For directives like 'private', use the default $value = true
public
addDirective(string $key[, string|bool $value = true ]) : $this
Parameters
- $key : string
- $value : string|bool = true
Return values
$thisfromString()
Creates a CacheControl object from a headerLine
public
static fromString(string $headerLine) : static
Parameters
- $headerLine : string
Tags
Return values
staticgetDirective()
Fetch the value of a directive from the internal directive array
public
getDirective(string $key) : string|null
Parameters
- $key : string
Return values
string|nullgetFieldName()
Required from HeaderDescription interface
public
getFieldName() : string
Return values
stringgetFieldValue()
Assembles the directives into a comma-delimited string
public
getFieldValue() : string
Return values
stringhasDirective()
Check the internal directives array for a directive
public
hasDirective(string $key) : bool
Parameters
- $key : string
Return values
boolisEmpty()
Checks if the internal directives array is empty
public
isEmpty() : bool
Return values
boolremoveDirective()
Remove a directive
public
removeDirective(string $key) : $this
Parameters
- $key : string
Return values
$thistoString()
Returns a string representation of the HTTP Cache-Control header
public
toString() : string
Return values
stringmatch()
Internal function used by parseValue to match tokens
protected
static match(array<string|int, mixed> $tokens, string &$string, string &$lastMatch) : int
Parameters
- $tokens : array<string|int, mixed>
- $string : string
- $lastMatch : string
Return values
intparseValue()
Internal function for parsing the value part of a HTTP Cache-Control header
protected
static parseValue(string $value) : array<string|int, mixed>
Parameters
- $value : string