HumHub Documentation (unofficial)

CacheControl
in package
implements HeaderInterface

Tags
see
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9
throws
InvalidArgumentException

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 = []

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
$this

fromString()

Creates a CacheControl object from a headerLine

public static fromString(string $headerLine) : static
Parameters
$headerLine : string
Tags
throws
InvalidArgumentException
Return values
static

getDirective()

Fetch the value of a directive from the internal directive array

public getDirective(string $key) : string|null
Parameters
$key : string
Return values
string|null

getFieldName()

Required from HeaderDescription interface

public getFieldName() : string
Return values
string

getFieldValue()

Assembles the directives into a comma-delimited string

public getFieldValue() : string
Return values
string

hasDirective()

Check the internal directives array for a directive

public hasDirective(string $key) : bool
Parameters
$key : string
Return values
bool

isEmpty()

Checks if the internal directives array is empty

public isEmpty() : bool
Return values
bool

removeDirective()

Remove a directive

public removeDirective(string $key) : $this
Parameters
$key : string
Return values
$this

toString()

Returns a string representation of the HTTP Cache-Control header

public toString() : string
Return values
string

match()

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
int

parseValue()

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
Tags
throws
InvalidArgumentException
Return values
array<string|int, mixed>

        
On this page

Search results