FeaturePolicy
in package
implements
HeaderInterface
Feature Policy (based on Editor’s Draft, 28 November 2019)
Tags
Table of Contents
Interfaces
- HeaderInterface
- Interface for HTTP Header classes.
Properties
- $directives : array<string|int, mixed>
- The directives defined for this policy
- $validDirectiveNames : array<string|int, string>
- Valid directive names
Methods
- fromString() : static
- Create Feature Policy header from a given header line
- getDirectives() : array<string|int, mixed>
- Get the list of defined directives
- getFieldName() : string
- Get the header name
- getFieldValue() : string
- Get the header value
- setDirective() : $this
- Sets the directive to consist of the source list
- toString() : string
- Return the header as a string
Properties
$directives
The directives defined for this policy
protected
array<string|int, mixed>
$directives
= []
$validDirectiveNames
Valid directive names
protected
array<string|int, string>
$validDirectiveNames
= [
// Standardized Features
'accelerometer',
'ambient-light-sensor',
'autoplay',
'battery',
'camera',
'display-capture',
'document-domain',
'fullscreen',
'execution-while-not-rendered',
'execution-while-out-of-viewport',
'gyroscope',
'magnetometer',
'microphone',
'midi',
'payment',
'picture-in-picture',
'sync-xhr',
'usb',
'wake-lock',
'xr',
// Proposed Features
'encrypted-media',
'geolocation',
'speaker',
// Experimental Features
'document-write',
'font-display-late-swap',
'layout-animations',
'loading-frame-default-eager',
'loading-image-default-eager',
'legacy-image-formats',
'oversized-images',
'sync-script',
'unoptimized-lossy-images',
'unoptimized-lossless-images',
'unsized-media',
'vertical-scroll',
'serial',
]
Tags
Methods
fromString()
Create Feature Policy header from a given header line
public
static fromString(string $headerLine) : static
Parameters
- $headerLine : string
-
The header line to parse.
Tags
Return values
staticgetDirectives()
Get the list of defined directives
public
getDirectives() : array<string|int, mixed>
Return values
array<string|int, mixed>getFieldName()
Get the header name
public
getFieldName() : string
Return values
stringgetFieldValue()
Get the header value
public
getFieldValue() : string
Return values
stringsetDirective()
Sets the directive to consist of the source list
public
setDirective(string $name, array<string|int, string> $sources) : $this
Parameters
- $name : string
-
The directive name.
- $sources : array<string|int, string>
-
The source list.
Tags
Return values
$thistoString()
Return the header as a string
public
toString() : string