MMOframework
Pourquoi l'IA Playground Bibliothèques Développeurs Agence
FR EN
Créer un projet en direct
Index

ApiDocument

MMO\core\events · 1 symbole · générée le 30 Nov 2026

class

ApiDocument

ApiDocument.php:15

Dispatched by Application::api once the OpenAPI document is built, before it is answered: a library adds to it what only it knows -- mmo.oauth its security schemes and each operation's scopes, an application the description of its tags. The listener changes $document in place.

class MMO\core\events\ApiDocument extends MMO\core\events\Event
Espace de noms
MMO\core\events
Étend
Event
ApiDocument::AddListener(function (ApiDocument $e) { $e->document['components']['securitySchemes']['bearer'] = ['type' => 'http', 'scheme' => 'bearer', 'bearerFormat' => 'JWT']; $e->operations(function (array &$operation, string $path, string $method) {$operation['security'] = [['bearer' => []]];}); });

Index

document
operations($fn)Call $fn on every operation of the document, by reference.
__construct($origin, $document)

Propriétés1

document

array $document
Type
array

Méthodes2

operations($fn)

ApiDocument.php:28

Call $fn on every operation of the document, by reference.

function operations(callable $fn): void
$fncallable
retournevoid

__construct($origin, $document)

ApiDocument.php:20
function __construct(object|string $origin, array $document)
$originobject | stringthe application
$documentarraythe OpenAPI document (openapi, info, servers, tags, paths, components)
Membres hérités (12)
PropriétésDéclaré parDescription
ListenersEvent
originEvent
MéthodesDéclaré parDescription
AddListener($handler, $order)EventRegister a listener directly (as opposed to ConnectListeners's attribute-based discovery).
ConnectListeners($obj)EventScan $obj's methods for #[Listen(EventClass::class)] attributes and register each one as a listener on the matching event class.
DisconnectListeners($obj)EventUndo a previous ConnectListeners: removes every listener that connect had registered for $obj on this event class.
dispatch()EventInvoke every GetListeners listener with $this.
GetListeners()EventCollect every listener for this class, including those registered on its parent classes (so a subclass event is also caught by listeners of its parent event), sorted by ascending $order (ties keep …
getOrigin()Event
HasListener($handler)Event
RemoveListener($handler)EventRemove the last added handler from the listeners.
Send($args)EventConstruct a new instance of this class with $args, then dispatch it to every listener.
SetListenerOrder($handler, $order)EventChange the order of an already-registered listener, whether added directly via AddListener or indirectly via ConnectListeners (which also stores its [$obj, $methodName] callables here).