ExtensionRegistry
API reference › Yii3 Debug › ExtensionRegistry
Holds the collectors and panels an application registered, ordered by the shared registration policy.
Panels reach ExtensionRegistry::panels() in the order PanelRegistry computes: built-in IDs keep their
registration order and every extension follows by position, then by effective title, then by ID.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Validates the registration keys, applies the configured metadata, and computes the navigation order. | ExtensionRegistry |
collectors() | Returns the collectors the application enabled. | ExtensionRegistry |
collectorsWithBuiltIn() | Returns the built-in collector first, unless the application explicitly registered an override with the same ID. | ExtensionRegistry |
collectorsWithBuiltIns() | Returns built-in collectors first, replacing each one with an explicitly registered collector of the same ID. | ExtensionRegistry |
create() static | Creates a registry from explicitly enabled collectors and panels. | ExtensionRegistry |
disabled() | Returns the IDs the configuration removed, which a host tells apart from an ID it never knew. | ExtensionRegistry |
fromParams() static | Creates a registry from the collectors and panels entries of the application configuration. | ExtensionRegistry |
panels() | Returns the panels the application enabled. | ExtensionRegistry |
panelsWithBuiltIn() | Returns the built-in panel first, unless the application explicitly registered an override with the same ID. | ExtensionRegistry |
panelsWithBuiltIns() | Returns built-in panels first, replacing each one with an explicitly registered panel of the same ID. | ExtensionRegistry |
withCollector() | Returns a copy with one more enabled collector appended. | ExtensionRegistry |
withPanel() | Returns a copy with one more enabled panel appended. | ExtensionRegistry |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(iterable<array-key, PHPForge\Debug\CollectorInterface> $collectors = [], iterable<array-key, Yii3\Debug\Panel\ExtensionPanelInterface|PHPForge\Debug\Panel> $panels = [], iterable<string, PHPForge\Debug\Registration\PanelOverride> $overrides = [], iterable<string> $disabled = [])Validates the registration keys, applies the configured metadata, and computes the navigation order.
Parameters
| Parameter | Type | Description |
|---|---|---|
$collectors | iterable<array-key, CollectorInterface> | Enabled collectors in capture order. |
$panels | iterable<array-key, Yii3\| | Enabled panels, in registration order. |
$overrides | iterable<string, | Application overrides indexed by panel ID. |
$disabled | iterable<string> | IDs the configuration disabled, so the host tells them from missing ones. |
Throws
InvalidArgumentException: when an ID is empty or duplicated, a string key does not match the ID the entry declares, or an override renames a panel rendering its own title and icon.
collectors()
Section titled “collectors() ”public function collectors(): list<PHPForge\Debug\CollectorInterface>Returns the collectors the application enabled.
Returns
list<CollectorInterface>: Enabled collectors in capture order.
collectorsWithBuiltIn()
Section titled “collectorsWithBuiltIn() ”public function collectorsWithBuiltIn(PHPForge\Debug\CollectorInterface $builtIn): list<PHPForge\Debug\CollectorInterface>Returns the built-in collector first, unless the application explicitly registered an override with the same ID.
A built-in whose ID the configuration disabled is dropped instead of placed first.
Parameters
| Parameter | Type | Description |
|---|---|---|
$builtIn | CollectorInterface | Built-in collector to place first. |
Returns
list<CollectorInterface>: Built-in and enabled collectors in capture order.
collectorsWithBuiltIns()
Section titled “collectorsWithBuiltIns() ”public function collectorsWithBuiltIns(iterable<PHPForge\Debug\CollectorInterface> $builtIns): list<PHPForge\Debug\CollectorInterface>Returns built-in collectors first, replacing each one with an explicitly registered collector of the same ID.
A built-in whose ID the configuration disabled is dropped instead of placed first.
Parameters
| Parameter | Type | Description |
|---|---|---|
$builtIns | iterable<CollectorInterface> | Built-in collectors in capture order. |
Returns
list<CollectorInterface>: Built-in and enabled collectors in capture order.
create()
Section titled “create() ”public static function create(iterable<array-key, PHPForge\Debug\CollectorInterface> $collectors = [], iterable<array-key, Yii3\Debug\Panel\ExtensionPanelInterface|PHPForge\Debug\Panel> $panels = [], iterable<string, PHPForge\Debug\Registration\PanelOverride> $overrides = [], iterable<string> $disabled = []): selfCreates a registry from explicitly enabled collectors and panels.
Parameters
| Parameter | Type | Description |
|---|---|---|
$collectors | iterable<array-key, CollectorInterface> | Enabled collectors in capture order. |
$panels | iterable<array-key, Yii3\| | Enabled panels, in registration order. |
$overrides | iterable<string, | Application overrides indexed by panel ID. |
$disabled | iterable<string> | IDs the configuration disabled. |
Returns
self: Registry holding the enabled collectors and panels.
Throws
InvalidArgumentException: when the registration is invalid.
disabled()
Section titled “disabled() ”public function disabled(): list<string>Returns the IDs the configuration removed, which a host tells apart from an ID it never knew.
Returns
list<string>: Disabled IDs, sorted alphabetically.
fromParams()
Section titled “fromParams() ”public static function fromParams(iterable<array-key, mixed> $collectors, iterable<array-key, mixed> $panels, Psr\Container\ContainerInterface $container): selfCreates a registry from the collectors and panels entries of the application configuration.
Every entry is a class string, or an array declaring a class string plus options. A collector accepts the
enabled option alone; a panel accepts the keys PanelOverride::KEYS. An entry the configuration
disabled is reported by ExtensionRegistry::disabled() and its class is never resolved.
Parameters
| Parameter | Type | Description |
|---|---|---|
$collectors | iterable<array-key, | Collector entries indexed by configuration ID. |
$panels | iterable<array-key, | Panel entries indexed by configuration ID. |
$container | Psr\ | Container the enabled classes are resolved from. |
Returns
self: Registry holding the enabled collectors and panels.
Throws
InvalidArgumentException: when an entry, an option, or the resulting registration is invalid.
panels()
Section titled “panels() ”public function panels(): list<Yii3\Debug\Panel\ExtensionPanelInterface>Returns the panels the application enabled.
Returns
list<Yii3\Debug\Panel\ExtensionPanelInterface>: Enabled panels in navigation order.
panelsWithBuiltIn()
Section titled “panelsWithBuiltIn() ”public function panelsWithBuiltIn(Yii3\Debug\Panel\ExtensionPanelInterface $builtIn): list<Yii3\Debug\Panel\ExtensionPanelInterface>Returns the built-in panel first, unless the application explicitly registered an override with the same ID.
A built-in whose ID the configuration disabled is dropped instead of placed first.
Parameters
| Parameter | Type | Description |
|---|---|---|
$builtIn | Yii3\ | Built-in panel to place first. |
Returns
list<Yii3\Debug\Panel\ExtensionPanelInterface>: Built-in and enabled panels in navigation order.
panelsWithBuiltIns()
Section titled “panelsWithBuiltIns() ”public function panelsWithBuiltIns(iterable<Yii3\Debug\Panel\ExtensionPanelInterface> $builtIns): list<Yii3\Debug\Panel\ExtensionPanelInterface>Returns built-in panels first, replacing each one with an explicitly registered panel of the same ID.
A built-in whose ID the configuration disabled is dropped instead of placed first.
Parameters
| Parameter | Type | Description |
|---|---|---|
$builtIns | iterable<Yii3\> | Built-in panels in navigation order. |
Returns
list<Yii3\Debug\Panel\ExtensionPanelInterface>: Built-in and enabled panels in navigation order.
withCollector()
Section titled “withCollector() ”public function withCollector(PHPForge\Debug\CollectorInterface $collector): selfReturns a copy with one more enabled collector appended.
Parameters
| Parameter | Type | Description |
|---|---|---|
$collector | CollectorInterface | Collector to enable. |
Returns
self: Registry including the collector.
Throws
InvalidArgumentException: when the collector ID is empty or already registered.
withPanel()
Section titled “withPanel() ”public function withPanel(Yii3\Debug\Panel\ExtensionPanelInterface|PHPForge\Debug\Panel $panel): selfReturns a copy with one more enabled panel appended.
Parameters
| Parameter | Type | Description |
|---|---|---|
$panel | Yii3\| | Panel to enable; a portable panel is adapted. |
Returns
self: Registry including the panel.
Throws
InvalidArgumentException: when the panel ID is empty or already registered.