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 | $conditions | <p>An array of conditions and their associated extenders.</p> |
Methods
whenExtensionEnabled(string $extensionId, callable|string $extenders)
<p>Apply extenders only if a specific extension is enabled.</p>
whenExtensionDisabled(string $extensionId, callable|string $extenders)
<p>Apply extenders only if a specific extension is disabled.</p>
when(callable|bool $condition, callable|string $extenders)
<p>Apply extenders based on a condition.</p>
Details
at
line 43
Conditional
whenExtensionEnabled(string $extensionId, callable|string $extenders)
<p>Apply extenders only if a specific extension is enabled.</p>
at
line 57
Conditional
whenExtensionDisabled(string $extensionId, callable|string $extenders)
<p>Apply extenders only if a specific extension is disabled.</p>
at
line 72
Conditional
when(callable|bool $condition, callable|string $extenders)
<p>Apply extenders based on a condition.</p>