MergeOption
Defines constants for the options used by the `merge` function.
Using these constants helps avoid typos and ensures consistent option handling.
Each constant corresponds to a configurable option:
CLEAN: Bitmask of CleanFlag constants for optional cleaning.DEEP: Enable recursive (deep) merge.INDEXED: Store values in sub-arrays (indexed).NULLS: How to handle null values ('skip', 'keep', 'overwrite').PRESERVE_KEYS: Preserve existing keys for numeric indices.UNIQUE: Remove duplicates in lists.
Tags
Table of Contents
Constants
- CLEAN = 'clean'
- Option key to defines the Bitmask of CleanFlag constants for optional cleaning.
- DEEP = 'deep'
- Option key to recursive merge.
- INDEXED = 'indexed'
- Option key to store values in sub-array
- NULLS = 'nulls'
- Option key to defines the "null" behaviors ('skip'|'keep'|'overwrite')
- PRESERVE_KEYS = 'preserveKeys'
- Option key to preserve numeric keys.
- UNIQUE = 'unique'
- Option key to avoid duplicates in lists.
Methods
- normalize() : array<string|int, mixed>
- Normalize an options array for merge function.
Constants
CLEAN
Option key to defines the Bitmask of CleanFlag constants for optional cleaning.
public
mixed
CLEAN
= 'clean'
DEEP
Option key to recursive merge.
public
mixed
DEEP
= 'deep'
Type: bool
INDEXED
Option key to store values in sub-array
public
mixed
INDEXED
= 'indexed'
NULLS
Option key to defines the "null" behaviors ('skip'|'keep'|'overwrite')
public
mixed
NULLS
= 'nulls'
PRESERVE_KEYS
Option key to preserve numeric keys.
public
mixed
PRESERVE_KEYS
= 'preserveKeys'
UNIQUE
Option key to avoid duplicates in lists.
public
mixed
UNIQUE
= 'unique'
Methods
normalize()
Normalize an options array for merge function.
public
static normalize([array<string|int, mixed>|null $options = [] ]) : array<string|int, mixed>
Fills in defaults for missing keys and ensures consistent option names.
Parameters
- $options : array<string|int, mixed>|null = []
-
User-provided options
Tags
Return values
array<string|int, mixed> —Normalized options with default values