UserCollector
API reference › Debug › collectors › UserCollector
Captures the authenticated identity for the User panel.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$module | yii\| | Debug module supplying the log target and sibling collectors, assigned by the module on registration. Default: null. | Collector |
$userComponent | string|yii\ | Component id of the user component, or a User instance to operate on directly. Default: 'user'. | UserCollector |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
capture() final | Encodes the typed snapshot built by the subclass into the payload persisted for the panel. | Collector |
id() | Returns the stable ID pairing this collector with the User panel. | UserCollector |
instrument() | Installs low-level instrumentation as soon as the module registers the collector, before the panels are built. | Collector |
shutdown() final | Deactivates the collector once, releasing any subscription created by start(). | Collector |
startup() final | Activates the collector once at the start of the request lifecycle. | Collector |
dataToString() protected | Returns the value when it is already a string, otherwise renders it with VarDumper::export(). | UserCollector |
getLogMessages() protected | Returns the accumulated log messages, optionally filtered by level, category, and exclusion lists. | Collector |
getLogTarget() protected | Returns the initialized log target of the owning debug module. | Collector |
getUser() protected | Returns the user component bound to this collector, or null when the configured component id does not resolve to a User instance. | UserCollector |
identityData() protected | Returns the identity attributes as a string-keyed map suitable for DetailView::$model. | UserCollector |
isStarted() protected | Returns whether the collector is active for the current request. | Collector |
snapshot() protected | Snapshots the identity attributes, the RBAC roles, and the permissions for the active user. | UserCollector |
start() protected | Hook invoked once when the collector activates; subclasses subscribe to framework events here. | Collector |
stop() protected | Hook invoked once when the collector deactivates; subclasses detach subscriptions and clear state here. | Collector |
Method details
Section titled “Method details”public function id(): stringReturns the stable ID pairing this collector with the User panel.
Returns
string: Stable collector ID.
dataToString()
Section titled “dataToString() ”protected function dataToString(mixed $data): stringReturns the value when it is already a string, otherwise renders it with VarDumper::export().
Parameters
| Parameter | Type | Description |
|---|---|---|
$data | mixed | Captured identity value. |
Returns
string: Display string for the User panel.
getUser()
Section titled “getUser() ”protected function getUser(): yii\web\User|nullReturns the user component bound to this collector, or null when the configured component id does not resolve
to a User instance.
Returns
yii\web\User|null: Bound user component, or null when the configured id does not resolve to one.
identityData()
Section titled “identityData() ”protected function identityData(yii\web\IdentityInterface $identity): array<string, mixed>Returns the identity attributes as a string-keyed map suitable for DetailView::$model.
Reads Model::getAttributes() when the identity is a Model; otherwise keeps only
public object properties.
Parameters
| Parameter | Type | Description |
|---|---|---|
$identity | yii\ | Active identity object. |
Returns
array<string, mixed>: Attribute map ready to feed the detail view.
snapshot()
Section titled “snapshot() ”protected function snapshot(): PHPForge\Debug\Panel\User\UserSnapshot|nullSnapshots the identity attributes, the RBAC roles, and the permissions for the active user.
Returns
PHPForge\Debug\Panel\User\UserSnapshot|null: Captured identity or Guest payload; null when the collector never started or the user component cannot be resolved.