Skip to content

IRoutingValue

Routing values are used internally and, optionally, by users in gen() calls and callbacks to have more control over encoding behavior and values in pre- and postfixes

interface IRoutingValue extends ArrayAccess, Stringable

ImplementsArrayAccess, Stringable
Implemented byRoutingValue
Since1.0.0
SourceRouting/IRoutingValue.php

abstract public function __construct(mixed $value, bool $valueNeedsEncoding = true): mixed

Constructor.

Whether or not the value needs encoding.

ParameterTypeDescription
$valuemixedThe value.
$valueNeedsEncodingboolWhether or not the value needs encoding.

Returns mixed

MethodDescription
__sleep(): mixedPre-serialization callback.
__toString(): stringReturn the encoded value (without pre- or postfix) for BC.
__wakeup(): mixedPost-unserialization callback.
equals(mixed $other): boolCheck if this routing value is equal to the given parameter.
getPostfix(): stringRetrieve the postfix.
getPostfixNeedsEncoding(): boolRetrieve whether or not the postfix needs to be encoded.
getPrefix(): stringRetrieve the prefix.
getPrefixNeedsEncoding(): boolRetrieve whether or not the prefix needs to be encoded.
getValue(): mixedRetrieve the value.
getValueNeedsEncoding(): boolRetrieve whether or not the value needs to be encoded.
hasPostfix(): boolCheck if a postfix is set.
hasPrefix(): boolCheck if a prefix is set.
initialize(Context $context, array<mixed> $parameters = []): voidInitialize the routing value.
setPostfix(string $value): voidSet the postfix.
setPostfixNeedsEncoding(bool $needsEncoding): voidSet whether or not the postfix needs to be encoded.
setPrefix(string $value): voidSet the prefix.
setPrefixNeedsEncoding(bool $needsEncoding): voidSet whether or not the prefix needs to be encoded.
setValue(mixed $value): voidSet the value.
setValueNeedsEncoding(bool $needsEncoding): voidSet whether or not the value needs to be encoded.

abstract public function __sleep(): mixed

Pre-serialization callback.

Will set the name of the context instead of the instance, which will later be restored by __wakeup().

Returns mixed

abstract public function __toString(): string

Return the encoded value (without pre- or postfix) for BC.

Returns string — The encoded value.

abstract public function __wakeup(): mixed

Post-unserialization callback.

Will restore the context instance based on their names set by __sleep().

Returns mixed

abstract public function equals(mixed $other): bool

Check if this routing value is equal to the given parameter.

The value to compare $this against.

ParameterTypeDescription
$othermixedThe value to compare $this against.

Returns bool — Whether the value matches $this.

abstract public function getPostfix(): string

Retrieve the postfix.

Returns string — The postfix.

abstract public function getPostfixNeedsEncoding(): bool

Retrieve whether or not the postfix needs to be encoded.

Returns bool — True, if the postfix needs encoding, false otherwise.

abstract public function getPrefix(): string

Retrieve the prefix.

Returns string — The prefix.

abstract public function getPrefixNeedsEncoding(): bool

Retrieve whether or not the prefix needs to be encoded.

Returns bool — True, if the prefix needs encoding, false otherwise.

abstract public function getValue(): mixed

Retrieve the value.

Returns mixed — The value.

abstract public function getValueNeedsEncoding(): bool

Retrieve whether or not the value needs to be encoded.

Returns bool — True, if the value needs encoding, false otherwise.

abstract public function hasPostfix(): bool

Check if a postfix is set.

Returns bool — True, if a postfix is set, false otherwise.

abstract public function hasPrefix(): bool

Check if a prefix is set.

Returns bool — True, if a prefix is set, false otherwise.

abstract public function initialize(Context $context, array<mixed> $parameters = []): void

Initialize the routing value.

An array of initialization parameters.

ParameterTypeDescription
$contextContextThe Context.
$parametersarray``<``mixed``>An array of initialization parameters.

abstract public function setPostfix(string $value): void

Set the postfix.

The postfix.

ParameterTypeDescription
$valuestringThe postfix.

abstract public function setPostfixNeedsEncoding(bool $needsEncoding): void

Set whether or not the postfix needs to be encoded.

True, if the postfix needs encoding, false otherwise.

ParameterTypeDescription
$needsEncodingboolTrue, if the postfix needs encoding, false otherwise.

abstract public function setPrefix(string $value): void

Set the prefix.

The prefix.

ParameterTypeDescription
$valuestringThe prefix.

abstract public function setPrefixNeedsEncoding(bool $needsEncoding): void

Set whether or not the prefix needs to be encoded.

True, if the prefix needs encoding, false otherwise.

ParameterTypeDescription
$needsEncodingboolTrue, if the prefix needs encoding, false otherwise.

abstract public function setValue(mixed $value): void

Set the value.

The value.

ParameterTypeDescription
$valuemixedThe value.

abstract public function setValueNeedsEncoding(bool $needsEncoding): void

Set whether or not the value needs to be encoded.

True, if the postfix needs encoding, false otherwise.

ParameterTypeDescription
$needsEncodingboolTrue, if the postfix needs encoding, false otherwise.

These come from an ancestor and are documented where they are declared.

MethodDeclared inDescription
offsetExists()ArrayAccess
offsetGet()ArrayAccess
offsetSet()ArrayAccess
offsetUnset()ArrayAccess