HashValue implements Stringable, SourceValueInterface
FinalYes
Representation of Content-Security-Policy hash source value see https://www.w3.org/TR/CSP3/#grammardef-hash-source
Table of Contents
Interfaces
- Stringable
- SourceValueInterface
- Interface used for self-contained source value models.
Properties
Methods
- __construct() : mixed
- __toString() : string
- compile() : string|null
- Compiled representation to be used for Content-Security-Policy HTTP header.
- create() : self
- hash() : self
- knows() : bool
- Determines whether a serialized representation is known and can be handled by a specific implementation, (e.g. "string starts with 'hash-proxy-").
- parse() : self
- Parses a known serialized representation as object representation.
- serialize() : string|null
- Serialized representation to be used for persisting declaration (e.g. in database).
Properties
$type read-only
public
HashType
$type
= HashType::sha256
$value read-only
public
string
$value
Methods
__construct()
public
__construct(string $value[, HashType $type = HashType::sha256 ]) : mixed
Parameters
- $value : string
-
hash value (binary, hex or base64 encoded)
- $type : HashType = HashType::sha256
__toString()
public
__toString() : string
Return values
stringcompile()
Compiled representation to be used for Content-Security-Policy HTTP header.
public
compile([FrontendInterface|null $cache = null ]) : string|null
Parameters
- $cache : FrontendInterface|null = null
Return values
string|null —null
means "not applicable / skip"
create()
public
static create(string $value[, HashType $type = HashType::sha256 ]) : self
Parameters
- $value : string
- $type : HashType = HashType::sha256
Return values
selfhash()
public
static hash(string $payload[, HashType $type = HashType::sha256 ]) : self
Parameters
- $payload : string
- $type : HashType = HashType::sha256
Return values
selfknows()
Determines whether a serialized representation is known and can be handled by a specific implementation, (e.g. "string starts with 'hash-proxy-").
public
static knows(string $value) : bool
Parameters
- $value : string
Return values
boolparse()
Parses a known serialized representation as object representation.
public
static parse(string $value) : self
Parameters
- $value : string
Return values
selfserialize()
Serialized representation to be used for persisting declaration (e.g. in database).
public
serialize() : string|null
Return values
string|null —null
means "not applicable / skip"