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
Synopsis
Section titled “Synopsis”interface IRoutingValue extends ArrayAccess, Stringable
| Implements | ArrayAccess, Stringable |
| Implemented by | RoutingValue |
| Since | 1.0.0 |
| Source | Routing/IRoutingValue.php |
Constructor
Section titled “Constructor”__construct()
Section titled “__construct()”abstract public function __construct(mixed $value, bool $valueNeedsEncoding = true): mixed
Constructor.
Whether or not the value needs encoding.
| Parameter | Type | Description |
|---|---|---|
$value | mixed | The value. |
$valueNeedsEncoding | bool | Whether or not the value needs encoding. |
Returns mixed
Methods
Section titled “Methods”| Method | Description |
|---|---|
__sleep(): mixed | Pre-serialization callback. |
__toString(): string | Return the encoded value (without pre- or postfix) for BC. |
__wakeup(): mixed | Post-unserialization callback. |
equals(mixed $other): bool | Check if this routing value is equal to the given parameter. |
getPostfix(): string | Retrieve the postfix. |
getPostfixNeedsEncoding(): bool | Retrieve whether or not the postfix needs to be encoded. |
getPrefix(): string | Retrieve the prefix. |
getPrefixNeedsEncoding(): bool | Retrieve whether or not the prefix needs to be encoded. |
getValue(): mixed | Retrieve the value. |
getValueNeedsEncoding(): bool | Retrieve whether or not the value needs to be encoded. |
hasPostfix(): bool | Check if a postfix is set. |
hasPrefix(): bool | Check if a prefix is set. |
initialize(Context $context, array<mixed> $parameters = []): void | Initialize the routing value. |
setPostfix(string $value): void | Set the postfix. |
setPostfixNeedsEncoding(bool $needsEncoding): void | Set whether or not the postfix needs to be encoded. |
setPrefix(string $value): void | Set the prefix. |
setPrefixNeedsEncoding(bool $needsEncoding): void | Set whether or not the prefix needs to be encoded. |
setValue(mixed $value): void | Set the value. |
setValueNeedsEncoding(bool $needsEncoding): void | Set whether or not the value needs to be encoded. |
__sleep()
Section titled “__sleep()”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
__toString()
Section titled “__toString()”abstract public function __toString(): string
Return the encoded value (without pre- or postfix) for BC.
Returns string — The encoded value.
__wakeup()
Section titled “__wakeup()”abstract public function __wakeup(): mixed
Post-unserialization callback.
Will restore the context instance based on their names set by __sleep().
Returns mixed
equals()
Section titled “equals()”abstract public function equals(mixed $other): bool
Check if this routing value is equal to the given parameter.
The value to compare $this against.
| Parameter | Type | Description |
|---|---|---|
$other | mixed | The value to compare $this against. |
Returns bool — Whether the value matches $this.
getPostfix()
Section titled “getPostfix()”abstract public function getPostfix(): string
Retrieve the postfix.
Returns string — The postfix.
getPostfixNeedsEncoding()
Section titled “getPostfixNeedsEncoding()”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.
getPrefix()
Section titled “getPrefix()”abstract public function getPrefix(): string
Retrieve the prefix.
Returns string — The prefix.
getPrefixNeedsEncoding()
Section titled “getPrefixNeedsEncoding()”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.
getValue()
Section titled “getValue()”abstract public function getValue(): mixed
Retrieve the value.
Returns mixed — The value.
getValueNeedsEncoding()
Section titled “getValueNeedsEncoding()”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.
hasPostfix()
Section titled “hasPostfix()”abstract public function hasPostfix(): bool
Check if a postfix is set.
Returns bool — True, if a postfix is set, false otherwise.
hasPrefix()
Section titled “hasPrefix()”abstract public function hasPrefix(): bool
Check if a prefix is set.
Returns bool — True, if a prefix is set, false otherwise.
initialize()
Section titled “initialize()”abstract public function initialize(Context $context, array<mixed> $parameters = []): void
Initialize the routing value.
An array of initialization parameters.
| Parameter | Type | Description |
|---|---|---|
$context | Context | The Context. |
$parameters | array``<``mixed``> | An array of initialization parameters. |
setPostfix()
Section titled “setPostfix()”abstract public function setPostfix(string $value): void
Set the postfix.
The postfix.
| Parameter | Type | Description |
|---|---|---|
$value | string | The postfix. |
setPostfixNeedsEncoding()
Section titled “setPostfixNeedsEncoding()”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.
| Parameter | Type | Description |
|---|---|---|
$needsEncoding | bool | True, if the postfix needs encoding, false otherwise. |
setPrefix()
Section titled “setPrefix()”abstract public function setPrefix(string $value): void
Set the prefix.
The prefix.
| Parameter | Type | Description |
|---|---|---|
$value | string | The prefix. |
setPrefixNeedsEncoding()
Section titled “setPrefixNeedsEncoding()”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.
| Parameter | Type | Description |
|---|---|---|
$needsEncoding | bool | True, if the prefix needs encoding, false otherwise. |
setValue()
Section titled “setValue()”abstract public function setValue(mixed $value): void
Set the value.
The value.
| Parameter | Type | Description |
|---|---|---|
$value | mixed | The value. |
setValueNeedsEncoding()
Section titled “setValueNeedsEncoding()”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.
| Parameter | Type | Description |
|---|---|---|
$needsEncoding | bool | True, if the postfix needs encoding, false otherwise. |
Inherited methods
Section titled “Inherited methods”These come from an ancestor and are documented where they are declared.
| Method | Declared in | Description |
|---|---|---|
offsetExists() | ArrayAccess | |
offsetGet() | ArrayAccess | |
offsetSet() | ArrayAccess | |
offsetUnset() | ArrayAccess |