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

AccessExplain

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

class

AccessExplain

AccessExplain.php:18

Sent by AccessController::routeExplain (access/explain.json) once it said what mmo.oauth checks of a call -- the scopes of its route, of its collection, a private collection: an application adds what only it checks, its perimeter (the establishments an account sees, the filter of a collection). Each reason is words for the account, and whether it allows (true), refuses (false) or only narrows (null) the call.

class MMO\oauth\events\AccessExplain extends MMO\core\events\Event
Espace de noms
MMO\oauth\events
Étend
Event
AccessExplain::AddListener(function (AccessExplain $e) { if ($e->collection === 'orders') {$e->add('perimeter', 'Only the orders of your shops: Lyon, Paris.', null, ['shops' => ['Lyon', 'Paris']]);} });

Propriétés5

account

readonly
readonly MMO\oauth\interfaces\iClient $account
Type
iClient

collection

readonly
readonly ?string $collection
Type
null | string

method

readonly
readonly string $method
Type
string

path

readonly
readonly string $path
Type
string

reasons

array $reasons = []
Type
array

Méthodes2

add($kind, $text, $allowed, $data)

AccessExplain.php:40

Add a reason.

function add(string $kind, string $text, ?bool $allowed = null, array $data = []): void
$kindstringperimeter, scope... what it is about
$textstringthe reason, in words for the account
$allowed = nullnull | booltrue: it allows the call; false: it refuses it; null: it narrows what the call answers
$data = []array
retournevoid

__construct($origin, $account, $method, $path, $collection)

AccessExplain.php:29
function __construct( object|string $origin, MMO\oauth\interfaces\iClient $account, string $method, string $path, ?string $collection = null )
$originobject | stringAccessController
$accountiClientthe account the call is explained for
$methodstringthe call's method, GET...
$pathstringthe call's path, relative to the site
$collection = nullnull | stringthe collection of the data api it names, if it does
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).