class Conditional implements ExtenderInterface
The Conditional extender allows developers to conditionally apply other extenders based on either boolean values or results from callable functions.
This is useful for applying extenders only if certain conditions are met, such as the presence of an enabled extension or a specific configuration setting.
Properties
| protected array<array{condition: bool| callable, extenders: callable| string}> | $conditions | An array of conditions and their associated extenders. |
|
Methods
Apply extenders only if a specific extension is enabled.
Apply extenders only if a specific extension is disabled.
Apply extenders only if all of the given extensions are enabled.
Apply extenders only if all of the given extensions are disabled.
Apply extenders only if a setting matches an expected value.
Apply extenders based on a condition.
Details
at
line 42
Conditional
whenExtensionEnabled(string $extensionId, callable|string $extenders)
Apply extenders only if a specific extension is enabled.
at
line 53
Conditional
whenExtensionDisabled(string $extensionId, callable|string $extenders)
Apply extenders only if a specific extension is disabled.
at
line 64
Conditional
whenExtensionsEnabled(array $extensionIds, callable|string $extenders)
Apply extenders only if all of the given extensions are enabled.
at
line 75
Conditional
whenExtensionsDisabled(array $extensionIds, callable|string $extenders)
Apply extenders only if all of the given extensions are disabled.
at
line 88
Conditional
whenSetting(string $key, mixed $expected, callable|string $extenders, bool $strict = false)
Apply extenders only if a setting matches an expected value.
at
line 100
Conditional
when(callable|bool $condition, callable|string $extenders)
Apply extenders based on a condition.