# PanelOverride

> Represents the panel metadata an application overrides in its debug configuration.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Registration](/docs/extensions/debug-core/reference/registration/index.md) › PanelOverride

| final readonly class | `PHPForge\Debug\Registration\PanelOverride` |
| --- | --- |
| Source | [`src/Registration/PanelOverride.php`](https://github.com/php-forge/debug-core/blob/main/src/Registration/PanelOverride.php#L24) |

Represents the panel metadata an application overrides in its debug configuration.

Every property stays `null` when the corresponding key is absent, so the provider default wins.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-enabled"></span>`$enabled` readonly constructor | `bool\|null` | `false` to remove the panel from the host, or `null` to keep it registered. Default: `null`. | `PanelOverride` |
| <span id="property-icon"></span>`$icon` readonly constructor | `string\|null` | Icon key replacing the provider default, or `null` to keep it. Default: `null`. | `PanelOverride` |
| <span id="property-position"></span>`$position` readonly constructor | `int\|null` | Sort weight among extensions, or `null` to order the entry by title. Default: `null`. | `PanelOverride` |
| <span id="property-title"></span>`$title` readonly constructor | `string\|null` | Display title replacing the provider default, or `null` to keep it. Default: `null`. | `PanelOverride` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates panel metadata overrides from the supplied values. | `PanelOverride` |
| [`fromArray()`](#method-fromArray) static | Creates an override from one panel entry of the application configuration. | `PanelOverride` |

## Constants

| Constant | Value | Description | Defined by |
| --- | --- | --- | --- |
| <span id="const-KEYS"></span>`KEYS` | `['enabled', 'icon', 'position', 'title']` | Configuration keys accepted by a panel entry, in alphabetical order. | `PanelOverride` |

## Method details

### __construct() <span id="method-__construct"></span>

```php
public function __construct(string|null $title = null, string|null $icon = null, bool|null $enabled = null, int|null $position = null)
```

Creates panel metadata overrides from the supplied values.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$title` | `string\|null` | Display title replacing the provider default, or `null` to keep it. |
| `$icon` | `string\|null` | Icon key replacing the provider default, or `null` to keep it. |
| `$enabled` | `bool\|null` | `false` to remove the panel from the host, or `null` to keep it registered. |
| `$position` | `int\|null` | Sort weight among extensions, or `null` to order the entry by title. |

### fromArray() <span id="method-fromArray"></span>

```php
public static function fromArray(array<array-key, mixed> $config): self
```

Creates an override from one panel entry of the application configuration.

Rejects unknown keys and wrong value types by key name. An empty array yields an override that changes nothing.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$config` | `array<array-key, mixed>` | Panel entry keyed by [`PanelOverride::KEYS`](/docs/extensions/debug-core/reference/registration/paneloverride/index.md#const-KEYS). |

**Returns**

`self`: Override carrying the configured values.

**Throws**

- [`InvalidArgumentException`](https://www.php.net/manual/en/class.invalidargumentexception.php): When a key is unknown, a value has the wrong type, or a value is invalid.