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 : string = 'clean'
- Option key to defines the Bitmask of CleanFlag constants for optional cleaning.
- DEEP : string = 'deep'
- Option key to recursive merge.
- INDEXED : string = 'indexed'
- Option key to store values in sub-array
- NULLS : string = 'nulls'
- Option key to defines the "null" behaviors ('skip'|'keep'|'overwrite')
- PRESERVE_KEYS : string = 'preserveKeys'
- Option key to preserve numeric keys.
- UNIQUE : string = 'unique'
- Option key to avoid duplicates in lists.
Methods
- normalize() : array<string, mixed>
- Normalize an options array for merge function.
Constants
CLEAN
Option key to defines the Bitmask of CleanFlag constants for optional cleaning.
public
string
CLEAN
= 'clean'
DEEP
Option key to recursive merge.
public
string
DEEP
= 'deep'
Type: bool
INDEXED
Option key to store values in sub-array
public
string
INDEXED
= 'indexed'
NULLS
Option key to defines the "null" behaviors ('skip'|'keep'|'overwrite')
public
string
NULLS
= 'nulls'
PRESERVE_KEYS
Option key to preserve numeric keys.
public
string
PRESERVE_KEYS
= 'preserveKeys'
UNIQUE
Option key to avoid duplicates in lists.
public
string
UNIQUE
= 'unique'
Methods
normalize()
Normalize an options array for merge function.
public
static normalize([array<string, mixed>|null $options = [] ]) : array<string, mixed>
Fills in defaults for missing keys and ensures consistent option names.
Parameters
- $options : array<string, mixed>|null = []
-
User-provided options
Tags
Return values
array<string, mixed> —Normalized options with default values