conditions.php
Table of Contents
Functions
- conditions() : array<string|int, mixed>
- Normalizes conditions into an array of callable functions.
Functions
conditions()
Normalizes conditions into an array of callable functions.
conditions([array<string|int, mixed>|callable|string|null $conditions = null ][, bool $throwable = false ]) : array<string|int, mixed>
This function takes a variety of input types (null, callable, or array of callables) and returns a normalized array of callable conditions. It is useful for validating or filtering data based on multiple conditions.
Parameters
- $conditions : array<string|int, mixed>|callable|string|null = null
-
The conditions to normalize. Can be:
- null: defaults to a condition that checks for null values.
- callable: a single condition function.
- array: an array of condition functions.
- $throwable : bool = false
-
If true, throws exceptions for invalid conditions. If false, silently filters out invalid conditions.
Tags
Return values
array<string|int, mixed> —An array of callable conditions.