Interface LaravelUi5\Core\Ui5\Emit\EmitterInterface

The seat that turns an artifact-shaped concern into one node of a server-rendered control tree.

Emitters are constructed by a family-specific transformer (the dashboard's {@see \LaravelUi5\Core\Ui5\Dashboard\Contracts\DashboardTransformerInterface} is the first; forms/tables/reports each bring their own typed one), which walks the artifact hierarchy once, builds emitters bottom-up via match (true) instanceof dispatch, and hands the root back to the controller. The controller's only call is $rootEmitter->emit($ctx) — the emitter chain walks itself by holding its children's emitters directly (no parallel "node" wrapper).

Constructor convention (load-bearing — the transformer relies on exactly two shapes):

  • Leaf emitters (Tile, Card) take their typed artifact as the sole arg:
  final readonly class TileEmitter implements EmitterInterface
  {
      public function __construct(private Ui5TileInterface $tile) {}
      // …
  }

The artifact is the source of every value the leaf emitter needs at emit() time — slot requirements, payload provider, the typed DTO factory method, etc.

  • Container emitters (Dashboard, Group) take their typed artifact plus an array of pre-built child emitters:
  final readonly class GroupEmitter implements EmitterInterface
  {
      public function __construct(
          private Ui5DashboardGroupInterface $group,
          /** @var EmitterInterface[] *\/
          private array $children,
      ) {}
      // …
  }

The container emitter calls the artifact's typed DTO factory (e.g. $this->group->getPanel()) for the consumer's template, recurses into its held child emitters to build the child elements, then injects them into the parent DTO via the appropriate withX() method (Panel::withContent, VBox::withItems, etc.).

No getElementEmitter() / getElementEmitterProperties() / EmittableInterface — the artifact-as-DTO-factory pivot dissolved those: artifacts own their DTO (typed factory method); the transformer owns dispatch (instanceof). See atom ARTIFACT_AS_DTO_FACTORY.md.

Downstream emitter authors pick the form that matches what their artifact contributes. A new container type follows the (artifact, array $children) shape; a new leaf type follows the typed-artifact shape. Custom emitters get wired by extending the default transformer and overriding the appropriate protected build method.

Methods