Skip to content

Internals Context Events GetContextEvent

Stefan Crkvenjakov edited this page Oct 7, 2026 · 1 revision

context\events\GetContextEvent

Framework Internals · Subsystem overview · Developer guide

Source: awt_src/classes/context/events/GetContextEvent.php · Snapshot 8411f4287706.

Context carries the current package root, name and ID. Context events let consumers request or replace that information through the dispatcher.

Imports and dependencies

use context\Context;
use event\interfaces\IEvent;

GetContextEvent

Declaration and architectural role

final class GetContextEvent implements IEvent

Constants, enum cases, traits and properties

Declarations below preserve visibility, type, default and modifiers exactly. A typed property without an initializer remains uninitialized until its constructor or another method assigns it. Mutable fields belong to this instance unless marked static; readonly fields can be initialized once. Constructor-promoted properties are also listed below.

Member Declaration Purpose or source contract
$context private Context $context; Used by getContext(), setContext().

Method index

Method Signature
getContext public function getContext(): Context
setContext public function setContext(Context $context): void
getName public function getName(): string
bundle public function bundle(): array

getContext

Source line 11

public function getContext(): Context

Return expressions (including local callbacks): $this->context.

Implementation, validation guards and interaction order
public function getContext(): Context
    {
        return $this->context;
    }

setContext

Source line 16

public function setContext(Context $context): void

Parameters

Parameter Type, modifiers and default Purpose
$context Context $context Package context object or package name according to the declared type.

State writes: $this->context.

Implementation, validation guards and interaction order
public function setContext(Context $context): void
    {
        $this->context = $context;
    }

getName

Source line 21

public function getName(): string

Return expressions (including local callbacks): 'context.get'.

Implementation, validation guards and interaction order
public function getName(): string
    {
        return 'context.get';
    }

bundle

Source line 26

public function bundle(): array

Return expressions (including local callbacks): ["context" => $this].

Implementation, validation guards and interaction order
public function bundle(): array
    {
        return ["context" => $this];
    }

Related types

Clone this wiki locally