SlotFlow API Documentation

DefaultSlotKeyCodec
in package
implements SlotCodec

Built-in dot-separated codec with wildcard and alternative support.

Tags
psalm-import-type

TSlotArrayPattern from SlotSpace

psalm-import-type

TSlotTuplePattern from SlotSpace

psalm-import-type

TDimensionValuePattern from SlotSpace

psalm-import-type

TDimensionName from SlotSpace

psalm-import-type

TDimensionValue from SlotSpace

Table of Contents

Interfaces

SlotCodec
Defines how slots are serialized, deserialized, and pattern-matched.

Constants

ALTERNATIVE  = '|'
NIL_KEY  = 'nil'
Represents source or sink
SEPARATOR  = '.'
WILDCARD  = '*'

Properties

$dimensionExpansions  : array<non-empty-string, array<non-empty-string, array<int, non-empty-string>>>
$space  : SlotSpace

Methods

__construct()  : mixed
alternative()  : non-empty-string
Return the token used to express value alternatives inside one dimension.
deserialize()  : array<non-empty-string, non-empty-string|null>|null
Parse a serialized slot key or pattern into its associative dimension form.
dimensionSeparator()  : non-empty-string
Return the separator used between serialized dimension values.
initialDimensionValueValidation()  : void
Validate that the dimension values are not incompatible with the separator, wildcard, or alternative characters used by the codec.
isWildcard()  : bool
Return true when the given value should be treated as a match-all wildcard.
matchDimensionValues()  : array<int, non-empty-string>
For a single dimension, find all values matching the given pattern, where the pattern can be: - a specific value, which matches only that value - a WILDCARD, which matches all values for that dimension - a string containing one or more WILDCARDs, which matches any value that fits the pattern - null or empty string, which are treated the same as the WILDCARD and match all values for that dimension - a series of ALTERNATIVE string patterns, e.g. 'a|b*d|d*'
nilKey()  : non-empty-string
Return the reserved key for the special nil source/sink slot.
serialize()  : non-empty-string
Serialize a slot or slot-pattern array to the codec's canonical string form.
validateDimensionValue()  : void
Validate that the given value is valid for the given dimension, and throw an exception if not.
validateDimensionValues()  : void
Validate that the given values are valid for their respective dimensions, and throw an exception if not. This is used to validate patterns before trying to match them.
wildcard()  : non-empty-string
Return the canonical wildcard token used by this codec.

Constants

Properties

$dimensionExpansions

private array<non-empty-string, array<non-empty-string, array<int, non-empty-string>>> $dimensionExpansions = []

Methods

alternative()

Return the token used to express value alternatives inside one dimension.

public alternative() : non-empty-string
Attributes
#[Override]
Return values
non-empty-string

deserialize()

Parse a serialized slot key or pattern into its associative dimension form.

public deserialize(string|null $key) : array<non-empty-string, non-empty-string|null>|null
Parameters
$key : string|null
Tags
psalm-return

?TSlotArrayPattern

Attributes
#[Override]
Return values
array<non-empty-string, non-empty-string|null>|null

dimensionSeparator()

Return the separator used between serialized dimension values.

public dimensionSeparator() : non-empty-string
Attributes
#[Override]
Return values
non-empty-string

initialDimensionValueValidation()

Validate that the dimension values are not incompatible with the separator, wildcard, or alternative characters used by the codec.

public initialDimensionValueValidation(array<non-empty-string, array<int, non-empty-string>> $dimensions) : void
Parameters
$dimensions : array<non-empty-string, array<int, non-empty-string>>
Attributes
#[Override]

isWildcard()

Return true when the given value should be treated as a match-all wildcard.

public isWildcard(string|null $value) : bool
Parameters
$value : string|null
Attributes
#[Override]
Return values
bool

matchDimensionValues()

For a single dimension, find all values matching the given pattern, where the pattern can be: - a specific value, which matches only that value - a WILDCARD, which matches all values for that dimension - a string containing one or more WILDCARDs, which matches any value that fits the pattern - null or empty string, which are treated the same as the WILDCARD and match all values for that dimension - a series of ALTERNATIVE string patterns, e.g. 'a|b*d|d*'

public matchDimensionValues(non-empty-string $dimension, string|null $pattern) : array<int, non-empty-string>
Parameters
$dimension : non-empty-string
$pattern : string|null
Attributes
#[Override]
Return values
array<int, non-empty-string>

nilKey()

Return the reserved key for the special nil source/sink slot.

public nilKey() : non-empty-string
Attributes
#[Override]
Return values
non-empty-string

serialize()

Serialize a slot or slot-pattern array to the codec's canonical string form.

public serialize(array<int, string|null>|array<non-empty-string, string|null>|null $values) : non-empty-string
Parameters
$values : array<int, string|null>|array<non-empty-string, string|null>|null
Tags
psalm-param

null|TSlotTuplePattern|TSlotArrayPattern $values

Attributes
#[Override]
Return values
non-empty-string

validateDimensionValue()

Validate that the given value is valid for the given dimension, and throw an exception if not.

public validateDimensionValue(non-empty-string $dimension, string|null $value, bool $allowWildcards) : void
Parameters
$dimension : non-empty-string
$value : string|null
$allowWildcards : bool
Tags
throws
SlotFlowInvalidArgumentException
Attributes
#[Override]

validateDimensionValues()

Validate that the given values are valid for their respective dimensions, and throw an exception if not. This is used to validate patterns before trying to match them.

public validateDimensionValues(array<non-empty-string, array<string|int, string|null>|string|null> $values[, bool $allowWildcards = false ][, bool $allowValueArrays = false ]) : void
Parameters
$values : array<non-empty-string, array<string|int, string|null>|string|null>
$allowWildcards : bool = false
$allowValueArrays : bool = false
Tags
throws
SlotFlowInvalidArgumentException
Attributes
#[Override]

wildcard()

Return the canonical wildcard token used by this codec.

public wildcard() : non-empty-string
Attributes
#[Override]
Return values
non-empty-string

        
On this page

Search results