Class: DumpOptions
Full name: Clarity\Debug\DumpOptions
Options for the dump renderers used by dump() and dd().
Pass an instance to ClarityEngineTrait::setDebugMode(). Each
option can be set through the constructor or through a fluent method of the
same name, so both styles can be combined:
// Named arguments
$engine->setDebugMode(new DumpOptions(
maxDepth: 4,
maskKeys: ['password', 'token'],
showPanel: true,
));
// Method chain
$engine->setDebugMode((new DumpOptions())->maxDepth(4)->maskKeys(['password']));
Each fluent method changes the instance and returns it. Changes to maxDepth, maxItems, maskKeys, forceToTemplate and haltWithException therefore apply to the engine after the DumpOptions was passed in. showPanel is read only when debug is enabled, so call setDebugMode() again to change it.
Public Properties
publicint$maxDepth·publicint$maxItems·publicarray$maskKeys·publicbool$forceToTemplate·publicbool$showPanel·publicbool$haltWithException·
Public methods
__construct() ·
public function __construct(int $maxDepth = 5, int $maxItems = 50, array $maskKeys = [], bool $forceToTemplate = false, bool $showPanel = false, bool $haltWithException = false): mixed
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$maxDepth |
int | 5 |
|
$maxItems |
int | 50 |
|
$maskKeys |
array | [] |
|
$forceToTemplate |
bool | false |
|
$showPanel |
bool | false |
|
$haltWithException |
bool | false |
Return value
- Type:
mixed
create() ·
public static function create(): Clarity\Debug\DumpOptions
Creates an instance with default options.
Return value
- Type: DumpOptions
maxDepth() ·
public function maxDepth(int $maxDepth): Clarity\Debug\DumpOptions
Sets the maximum nesting depth rendered.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$maxDepth |
int | - |
Return value
- Type: DumpOptions
maxItems() ·
public function maxItems(int $maxItems): Clarity\Debug\DumpOptions
Sets the maximum number of array items shown per level.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$maxItems |
int | - |
Return value
- Type: DumpOptions
maskKeys() ·
public function maskKeys(array $maskKeys): Clarity\Debug\DumpOptions
Replaces the mask list. A key is masked when its name contains one of these substrings, case-insensitively. Array keys and object property names are checked.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$maskKeys |
array | - |
Return value
- Type: DumpOptions
maskKey() ·
public function maskKey(string $maskKey): Clarity\Debug\DumpOptions
Adds a substring to the mask list.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$maskKey |
string | - |
Return value
- Type: DumpOptions
unmaskKey() ·
public function unmaskKey(string $maskKey): Clarity\Debug\DumpOptions
Removes a substring from the mask list.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$maskKey |
string | - |
Return value
- Type: DumpOptions
forceToTemplate() ·
public function forceToTemplate(bool $forceToTemplate = true): Clarity\Debug\DumpOptions
CLI only. When true, dump() returns the rendered string instead of writing it to STDERR. When false (default), dump() writes to STDERR and returns ''. dd() always writes to STDERR and ignores this option.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$forceToTemplate |
bool | true |
Return value
- Type: DumpOptions
showPanel() ·
public function showPanel(bool $showPanel = true): Clarity\Debug\DumpOptions
Shows or hides the HTML debug panel. Takes effect when debug is enabled.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$showPanel |
bool | true |
Return value
- Type: DumpOptions
haltWithException() ·
public function haltWithException(bool $haltWithException = true): Clarity\Debug\DumpOptions
dd() only. When true, dd() throws a DumpHaltException with the
rendered dump instead of calling exit(1). Use it in hosts that keep the
PHP process alive between requests, such as RoadRunner, so that one dd()
ends one request and not the worker. The exception is thrown on every
SAPI, including the CLI.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$haltWithException |
bool | true |
Return value
- Type: DumpOptions
getMaxDepth() ·
public function getMaxDepth(): int
Return value
- Type:
int
getMaxItems() ·
public function getMaxItems(): int
Return value
- Type:
int
getMaskKeys() ·
public function getMaskKeys(): array
Return value
- Type:
array
getForceToTemplate() ·
public function getForceToTemplate(): bool
Return value
- Type:
bool
getShowPanel() ·
public function getShowPanel(): bool
Return value
- Type:
bool
getHaltWithException() ·
public function getHaltWithException(): bool
Return value
- Type:
bool