VariableProcessor

Helper for processing various variables within a Route Enhancer

Attributes
#[Autoconfigure]
$public: true
$shared: false

Table of Contents

Constants

ARGUMENT_SEPARATOR  = '/'
LEVEL_DELIMITER  = '__'
VARIABLE_PATTERN  = '#\{(?P<modifier>!)?(?P<name>[^}]+)\}#'

Properties

$hashes  : array<string|int, mixed>
$nestedValues  : array<string|int, mixed>

Methods

__construct()  : mixed
deflateKeys()  : array<string|int, mixed>
Deflates keys names on the first level, now recursion into sub-arrays.
deflateNamespaceParameters()  : array<string|int, mixed>
Deflates (flattens) route/request parameters for a given namespace.
deflateParameters()  : array<string|int, mixed>
Deflates (flattens) route/request parameters for a given namespace.
deflateRoutePath()  : string
inflateKeys()  : array<string|int, mixed>
Inflates keys names on the first level, now recursion into sub-arrays.
inflateNamespaceParameters()  : array<string|int, mixed>
Inflates (unflattens) route/request parameters.
inflateParameters()  : array<string|int, mixed>
Inflates (unflattens) route/request parameters.
inflateRoutePath()  : string
addHash()  : string
addNestedValue()  : string
deflateArray()  : array<string|int, mixed>
Deflates (flattens) array having nested structures.
deflateValues()  : array<string|int, mixed>
Deflates plain values.
generateHash()  : string
inflateArray()  : array<string|int, mixed>
Inflates (unflattens) an array into nested structures.
inflateNestedValue()  : string
inflateValues()  : array<string|int, mixed>
Inflates plain values.
requiresHashing()  : bool
Determines whether a parameter value requires hashing.
resolveHash()  : string
resolveNestedValue()  : string

Constants

ARGUMENT_SEPARATOR

protected mixed ARGUMENT_SEPARATOR = '/'

LEVEL_DELIMITER

protected mixed LEVEL_DELIMITER = '__'

VARIABLE_PATTERN

protected mixed VARIABLE_PATTERN = '#\{(?P<modifier>!)?(?P<name>[^}]+)\}#'

Properties

$hashes

protected array<string|int, mixed> $hashes = []

$nestedValues

protected array<string|int, mixed> $nestedValues = []

Methods

deflateKeys()

Deflates keys names on the first level, now recursion into sub-arrays.

public deflateKeys(array<string|int, mixed> $items[, string|null $namespace = null ][, array<string|int, mixed> $arguments = [] ][, bool $hash = true ]) : array<string|int, mixed>

Can be used to adjust key names of route requirements, mappers, etc.

Parameters
$items : array<string|int, mixed>
$namespace : string|null = null
$arguments : array<string|int, mixed> = []
$hash : bool = true

= true

Return values
array<string|int, mixed>

deflateNamespaceParameters()

Deflates (flattens) route/request parameters for a given namespace.

public deflateNamespaceParameters(array<string|int, mixed> $parameters, string $namespace[, array<string|int, mixed> $arguments = [] ]) : array<string|int, mixed>
Parameters
$parameters : array<string|int, mixed>
$namespace : string
$arguments : array<string|int, mixed> = []
Return values
array<string|int, mixed>

deflateParameters()

Deflates (flattens) route/request parameters for a given namespace.

public deflateParameters(array<string|int, mixed> $parameters[, array<string|int, mixed> $arguments = [] ]) : array<string|int, mixed>
Parameters
$parameters : array<string|int, mixed>
$arguments : array<string|int, mixed> = []
Return values
array<string|int, mixed>

deflateRoutePath()

public deflateRoutePath(string $routePath[, string|null $namespace = null ][, array<string|int, mixed> $arguments = [] ]) : string
Parameters
$routePath : string
$namespace : string|null = null
$arguments : array<string|int, mixed> = []
Return values
string

inflateKeys()

Inflates keys names on the first level, now recursion into sub-arrays.

public inflateKeys(array<string|int, mixed> $items[, string|null $namespace = null ][, array<string|int, mixed> $arguments = [] ][, bool $hash = true ]) : array<string|int, mixed>

Can be used to adjust key names of route requirements, mappers, etc.

Parameters
$items : array<string|int, mixed>
$namespace : string|null = null
$arguments : array<string|int, mixed> = []
$hash : bool = true

= true

Return values
array<string|int, mixed>

inflateNamespaceParameters()

Inflates (unflattens) route/request parameters.

public inflateNamespaceParameters(array<string|int, mixed> $parameters, string $namespace[, array<string|int, mixed> $arguments = [] ]) : array<string|int, mixed>
Parameters
$parameters : array<string|int, mixed>
$namespace : string
$arguments : array<string|int, mixed> = []
Return values
array<string|int, mixed>

inflateParameters()

Inflates (unflattens) route/request parameters.

public inflateParameters(array<string|int, mixed> $parameters[, array<string|int, mixed> $arguments = [] ]) : array<string|int, mixed>
Parameters
$parameters : array<string|int, mixed>
$arguments : array<string|int, mixed> = []
Return values
array<string|int, mixed>

inflateRoutePath()

public inflateRoutePath(string $routePath[, string|null $namespace = null ][, array<string|int, mixed> $arguments = [] ]) : string
Parameters
$routePath : string
$namespace : string|null = null
$arguments : array<string|int, mixed> = []
Return values
string

addHash()

protected addHash(string $value) : string
Parameters
$value : string
Return values
string

addNestedValue()

protected addNestedValue(string $value) : string
Parameters
$value : string
Return values
string

deflateArray()

Deflates (flattens) array having nested structures.

protected deflateArray(array<string|int, mixed> $array[, string $prefix = '' ]) : array<string|int, mixed>
Parameters
$array : array<string|int, mixed>
$prefix : string = ''
Return values
array<string|int, mixed>

deflateValues()

Deflates plain values.

protected deflateValues(array<string|int, mixed> $values[, string|null $namespace = null ][, array<string|int, mixed> $arguments = [] ][, bool $hash = true ]) : array<string|int, mixed>
Parameters
$values : array<string|int, mixed>
$namespace : string|null = null
$arguments : array<string|int, mixed> = []
$hash : bool = true
Return values
array<string|int, mixed>

generateHash()

protected generateHash(string $value) : string
Parameters
$value : string
Return values
string

inflateArray()

Inflates (unflattens) an array into nested structures.

protected inflateArray(array<string|int, mixed> $array, string $namespace, array<string|int, mixed> $arguments) : array<string|int, mixed>
Parameters
$array : array<string|int, mixed>
$namespace : string
$arguments : array<string|int, mixed>
Return values
array<string|int, mixed>

inflateNestedValue()

protected inflateNestedValue(string $value, string $namespace, array<string|int, mixed> $arguments) : string
Parameters
$value : string
$namespace : string
$arguments : array<string|int, mixed>
Return values
string

inflateValues()

Inflates plain values.

protected inflateValues(array<string|int, mixed> $values[, string|null $namespace = null ][, array<string|int, mixed> $arguments = [] ][, bool $hash = true ]) : array<string|int, mixed>
Parameters
$values : array<string|int, mixed>
$namespace : string|null = null
$arguments : array<string|int, mixed> = []
$hash : bool = true
Return values
array<string|int, mixed>

requiresHashing()

Determines whether a parameter value requires hashing.

protected requiresHashing(string $value) : bool

This is the case if the value has 31+ chars (Symfony has a limitation of 32 chars), or if the value contains any non-word characters besides [A-Za-z0-9_], such as @.

Parameters
$value : string
Return values
bool

resolveHash()

protected resolveHash(string $hash) : string
Parameters
$hash : string
Tags
throws
OutOfRangeException
Return values
string

resolveNestedValue()

protected resolveNestedValue(string $value) : string
Parameters
$value : string
Return values
string

        
On this page

Search results