Index

Route

MMO\core\server · 1 symbol · generated 30 Sep 2026

class

Route

Route.php:50
# API [json api](https://jsonapi.org/format/#query-parameters-families)class MMO\core\server\Route extends MMO\core\events\Event implements MMO\core\interfaces\iStoppableEvent, MMO\core\interfaces\iUriProvider, MMO\core\interfaces\iLogEmitter, Psr\Http\Server\RequestHandlerInterface, Countable use MMO\core\classes\tStoppableEvent, MMO\core\classes\tLogEmitter
Namespace
MMO\core\server
Extends
Event
Implements
iStoppableEvent, iUriProvider, iLogEmitter, RequestHandlerInterface, Countable
Uses traits
tStoppableEvent, tLogEmitter
## Pagination the pagination is provided in the query with `page[offset]` and `page[limit]` example: xxx?page[offset]=0&page[limit]=10 ## Sort request the sorting parameter is provided in the query as a comma separated value, with - for descending sorting example: xxx?sort=-created,title => sort by create(DESC) and title(ASC) ## Add/show fields example fields=title,-body ## Filter request the filter is provided as a family under the format `filter[xxx]` example: xxx?filters[age][$gt]=20&filters[age][$lt]=50&filters[author.status]=active => (age > 20) && (age < 50) && (author.status = active) example xxx?filters[$or][$and][age][&gt]=20&filters[$or][$and][name]=marc&filters[$or][age][$lt]=20 => ((age > 20) and (name = 'marc')) or (age < 20) A Route drives one request/response cycle through a chain of middlewares ([`addMiddleware`](https://mmoframework.fr/documentation/mmo.core/php/server/Route.md#route-addmiddleware)/[`handle`](https://mmoframework.fr/documentation/mmo.core/php/server/Route.md#route-handle)), giving each one access to the request ([`getRequest`](https://mmoframework.fr/documentation/mmo.core/php/server/Route.md#route-getrequest)/[`get`](https://mmoframework.fr/documentation/mmo.core/php/server/Route.md#route-get)) and letting it build up the response ([`addContent`](https://mmoframework.fr/documentation/mmo.core/php/server/Route.md#route-addcontent)/[`setResponse`](https://mmoframework.fr/documentation/mmo.core/php/server/Route.md#route-setresponse)) before the next one runs.
$route = new Route($app); $route->setRequest($request->withAttribute('id', 42)); $route->setResponse(Response::Json([])); // a middleware returning an array (below) merges into this $route->addMiddleware(fn (Route $r) => ['user' => $r->get('id')], [], 0); $response = $route->handle(); // runs every middleware, then returns the final response $response->render(); // '{"meta":[],"links":[],"data":{"user":42},"logs":[]}'

Index

IN_ATTRIBUTES
IN_BODY
IN_COOKIE
IN_FILES
IN_HEADERS
IN_QUERY
NO_RESPONSEthe error when content is added before any response exists: the usual cause is a handler returning an array from a controller that sets no response, so the message says how to fix that
currentMiddleware
errorHandler
middlewares
request
response
sortMiddlewares
stopped
verbosity
addContent($data)Merge $data into the current response's content -- in place if it's our own Response class (whose document can be mutated directly), or via a new immutable iResponse::withParsedBody insta…
addMiddleware($middleware, $parameters, $order)
addMiddlewareParameters($middleware, $params)
alert($message, $context)Action must be taken immediately.
backtraces($message, $context)Force-log a message at INFO level together with a full stack trace/memory snapshot (iLogLevel::BACKTRACE), bypassing the verbosity mask entirely (any non-zero verbosity is enough to trigger it).
checkQueryPath($query, $path)What a query returns tells the values it filters or sorts on, so a request cannot use a hidden property (ArrayProperty::isHidden) that way: `?filters[passhash][$regex]=/^.…
clearMiddlewares()Remove every registered middleware.
clearNonAnonymousMiddleware()Remove every registered middleware whose parameters don't have 'anonymous' => true set.
count()
createAcceptResponse($document, $status, $reason, $headers)Build a Response in whichever of html/json/plain-text format the client's Accept header prefers (negotiateMimeType), via Response::FromMime.
critical($message, $context)Critical conditions. No-op if CRITICAL is currently filtered out by the verbosity mask.
debug($message, $context)Detailed debug information.
debugName()Human-readable identifier used as the default {origin} in this instance's log messages.
emergency($message, $context)System is unusable. No-op if EMERGENCY is currently filtered out by the verbosity mask.
error($message, $context)Runtime errors that do not require immediate action but should typically be logged and monitored.
extractQuery($query, $where)Extract pagination/sort/filter/field-selection options from the request's query and/or body (JSON:API-style -- the class docblock) and apply them onto $query.
FilterPaths($filter) static
get($key, $default, $where)
getAttribute($key, $default)
getAttributes()
getBasicAuthCredentials($allowInBody)Retrieve HTTP Basic Auth credentials with the Authorization header of a request, or the parameters in the body.
getCharset()
getClassMiddleware($obj)
getContentType()
getController()
getCurrentMiddleware()
getErrorHandler()
getExtension()
getFormat()
getMiddlewareParameters($middleware)
getMiddlewarePriority($middleware)
getMiddlewares()
getRequest()
getRequestBody()
getResponse()
getResponseBody()Get response's parsed body
getUri($unlock)
getVerbosity()
handle($request)
has($key, $where)
hasAttribute($key)
hasController()
hasResponse()
info($message, $context)Interesting events. No-op if INFO is currently filtered out by the verbosity mask.
isDelete()
isGet()
isHead()
isPost()
isPropagationStopped()
isPut()
log($level, $message, $context)Logs with an arbitrary level.
makeContentTypeHeader()
negotiateCharset($supported, $default)Negotiates charset with the user's browser through the Accept-Charset HTTP header.
negotiateLanguage($supported, $default)Negotiates language with the user's browser through the Accept-Language HTTP header or the user's host address.
negotiateMimeType($supported, $default)Negotiates content type with the user's browser through the Accept HTTP header.
nextMiddleware()
notice($message, $context)Normal but significant events.
redirect($redirectUri, $headers, $post, $status, $reason)Stop the route with a redirect response (Response::Redirect).
removeClassMiddleware($obj)Remove every registered middleware bound to $obj -- i.e.
removeMiddleware($middleware)
setAttribute($key, $value)
setController($controller)
setErrorHandler($handler)Add an handler for errors
setFormat($format, $charset)Set the request's 'format'/'charset' attributes (getFormat/getCharset), and, if a response is already set, update its Content-Type header to match (makeContentTypeHeader).
setMiddlewareOrder($middleware, $order)
setMiddlewareParameters($middleware, $params)
setRequest($request)
setResponse($response)
setVerbosity($verb)Set the current verbosity mask, replacing whatever it was before.
sortMiddlewares()Sort $middlewares in the reversed order nextMiddleware's array_pop expects (addMiddleware's $order: lower runs first).
stop($response)Stop processing further middlewares (clearMiddlewares), optionally setting the final response first.
stopPropagation()Prevent any remaining listener in the current dispatch chain from being called.
testVerbosity($level)Test whether a given level (or set of levels) is currently enabled by this instance's verbosity mask.
warning($message, $context)Exceptional occurrences that are not errors.
withAttributes($attrs)
__clone()A cloned event starts fresh: propagation is never considered stopped on the clone, even if it was on the original instance.

Constants7

IN_ATTRIBUTES

const IN_ATTRIBUTES = 32
See
get/has's $where bitmask: look in the request's attributes (route params, middleware-set values).

IN_BODY

const IN_BODY = 2
See
get/has's $where bitmask: look in the request's parsed body.

IN_FILES

const IN_FILES = 16
See
get/has's $where bitmask: look in the request's uploaded files.

IN_HEADERS

const IN_HEADERS = 4
See
get/has's $where bitmask: look in the request's headers.

IN_QUERY

const IN_QUERY = 1
See
get/has's $where bitmask: look in the request's query string.

NO_RESPONSE

the error when content is added before any response exists: the usual cause is a handler returning an array from a controller that sets no response, so the message says how to fix that

const NO_RESPONSE = 'route has no response set: return an iResponse from the handler (e.g. Response::Json($data)), set one in the controller\'s onRoute(), or extend aDataController, which sets a JSON response.'

Properties8

currentMiddleware

protected $currentMiddleware = null

errorHandler

protected $errorHandler = null

middlewares

protected $middlewares = []

request

protected $request = null

response

protected ?MMO\core\interfaces\iResponse $response = null
Type
null | iResponse

sortMiddlewares

private bool $sortMiddlewares = false
Type
bool

stopped

protected $stopped = false

verbosity

#[MMO\core\attributes\Serialize(order: -1000)] protected int $verbosity = 31
Type
int

Methods76

addMiddleware($middleware, $parameters, $order)

Route.php:665
function addMiddleware(callable $middleware, array $parameters = [], int $order = 0): self
$middlewarecallablefunction(Route $route): iResponse|array|\ArrayAccess|null -- an array/\ArrayAccess return is merged into the current response's content (addContent); an iResponse replaces it (setResponse); null/no return continues to the next middleware.
$parameters = []arraymerged into the request's attributes (aRequest::withAttributes) right before this middleware runs.
$order = 0intexecution order -- LOWER runs first, HIGHER runs later; middlewares with the same $order run in the order they were added.
returnsself
$route->addMiddleware(fn (Route $r) => ['ok' => true], [], 0);

addMiddlewareParameters($middleware, $params)

Route.php:725
function addMiddlewareParameters(callable $middleware, array $params): self
$middlewarecallablemust be === the exact callable passed to addMiddleware.
$paramsarraymerged into the middleware's existing parameters (merge).
returnsself

alert($message, $context)

tLogEmitter.php:121

Action must be taken immediately.

function alert(Stringable|string $message, array $context = []): voidExample: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.
$messageStringable | string
$context = []array
returnsvoid
$this->alert('payment gateway unreachable for 5 minutes.');

backtraces($message, $context)

tLogEmitter.php:234

Force-log a message at INFO level together with a full stack trace/memory snapshot (iLogLevel::BACKTRACE), bypassing the verbosity mask entirely (any non-zero verbosity is enough to trigger it).

function backtraces(string $message = ' -- TRACES -- ', array $context = []): void
$message = ' -- TRACES -- 'string
$context = []array
returnsvoid
$this->backtraces('unexpected state reached in {method}.', ['method' => __METHOD__]);

checkQueryPath($query, $path)

Route.php:180

What a query returns tells the values it filters or sorts on, so a request cannot use a hidden property (ArrayProperty::isHidden) that way: ?filters[passhash][$regex]=/^.2y/ would find a password's hash out one character at a time. Nor MongoDB's $where, $expr and $jsonSchema, which can read any property. (Named in ?fields=, a hidden property is simply left out: tArrayProperties::toArray)

function checkQueryPath(MMO\core\entities\Query $query, string $path): string
$queryQuery
$pathstringa path the request filters or sorts on (owner/passhash, or owner.passhash)
returnsstring$path
throws(400 Bad Request) if the request cannot use it
$route->checkQueryPath($users->query(), 'passhash'); // throws: `@hidden`

clearMiddlewares()

Route.php:784

Remove every registered middleware.

function clearMiddlewares(): self
returnsself

clearNonAnonymousMiddleware()

Route.php:797

Remove every registered middleware whose parameters don't have 'anonymous' => true set.

function clearNonAnonymousMiddleware(): void
returnsvoid

createAcceptResponse($document, $status, $reason, $headers)

Route.php:560

Build a Response in whichever of html/json/plain-text format the client's Accept header prefers (negotiateMimeType), via Response::FromMime.

function createAcceptResponse( MMO\core\documents\Document|array|null $document = null, int $status = 200, string $reason = '', array $headers = [] ): MMO\core\server\ResponseNOTE: per [`Response::FromMime`](https://mmoframework.fr/documentation/mmo.core/php/server/Response.md#response-frommime), $document must be null or an already-built Document if negotiation resolves to 'text/html' -- there's no array-to-markup mapping, so a plain array $document throws eInvalid whenever the client accepts html.
$document = nullDocument | array | null
$status = 200int
$reason = ''string
$headers = []array
returnsResponse

critical($message, $context)

tLogEmitter.php:138

Critical conditions. No-op if CRITICAL is currently filtered out by the verbosity mask.

function critical(Stringable|string $message, array $context = []): voidExample : Application component unavailable, unexpected exception.
$messageStringable | string
$context = []array
returnsvoid
$this->critical('unexpected {exception}.', ['exception' => $e]);

debug($message, $context)

tLogEmitter.php:219

Detailed debug information. No-op if DEBUG is currently filtered out by the verbosity mask.

function debug(Stringable|string $message, array $context = []): void
$messageStringable | string
$context = []array
returnsvoid
$this->debug('set stream [{stream}].', ['stream' => $stream]);

debugName()

tLogEmitter.php:30

Human-readable identifier used as the default {origin} in this instance's log messages.

function debugName(): stringOverride this in a class using the trait to show something more specific than the bare classname.
returnsstring

emergency($message, $context)

tLogEmitter.php:103

System is unusable. No-op if EMERGENCY is currently filtered out by the verbosity mask.

function emergency(Stringable|string $message, array $context = []): void
$messageStringable | string
$context = []array
returnsvoid
$this->emergency('database connection lost.');

error($message, $context)

tLogEmitter.php:154

Runtime errors that do not require immediate action but should typically be logged and monitored.

function error(Stringable|string $message, array $context = []): voidNo-op if ERROR is currently filtered out by the verbosity mask.
$messageStringable | string
$context = []array
returnsvoid
$this->error('failed to write [{file}].', ['file' => $filename]);

extractQuery($query, $where)

Route.php:127

Extract pagination/sort/filter/field-selection options from the request's query and/or body (JSON:API-style -- the class docblock) and apply them onto $query.

function extractQuery(MMO\core\entities\Query $query, int $where = 3): MMO\core\entities\QueryUse this options with collection->filter(..., $opts) A request cannot filter or sort on a hidden property ([`ArrayProperty::isHidden`](https://mmoframework.fr/documentation/mmo.core/php/attributes/ArrayProperty.md#arrayproperty-ishidden)): what the query returns would tell its value ([`checkQueryPath`](https://mmoframework.fr/documentation/mmo.core/php/server/Route.md#route-checkquerypath)).
$queryQuerythe query to populate.
$where = 3inta IN_QUERY/IN_BODY/... bitmask of where to look for each parameter.
returnsQuery$query, for chaining.
throws(400 Bad Request) for a filter or a sort on a hidden property

FilterPaths($filter)

staticRoute.php:196
static function FilterPaths(MMO\core\interfaces\iFilter $filter): Generator
$filteriFilter
returnsGeneratorevery path $filter reads: those of its conditions (in its groups too), and those they compare with ({#path})
iterator_to_array(Route::FilterPaths(Filter::From('(name = {#nickname}) | (age > 18)')), false); // ['name', 'nickname', 'age']

get($key, $default, $where)

Route.php:344
function get(string $key, mixed $default = null, int $where = -1): mixed
$keystring
$default = nullmixedreturned if $key is found nowhere in $where.
$where = -1inta IN_QUERY/IN_BODY/... bitmask of where to look, checked in this fixed order: attributes, query, body, headers, cookies, files (the first match wins).
returnsmixed
$route->get('page', 1, Route::IN_QUERY);

getAttribute($key, $default)

Route.php:387
function getAttribute(string $key, mixed $default = null)
$keystring
$default = nullmixed
returnsthe request attribute $key, or $default if unset.

getAttributes()

Route.php:397
function getAttributes(): array
returnsarrayevery request attribute.

getBasicAuthCredentials($allowInBody)

Route.php:446

Retrieve HTTP Basic Auth credentials with the Authorization header of a request, or the parameters in the body. First index of the returned array is the username, second is the password (so list() will work). If the header does not exist, or is otherwise an invalid HTTP Basic header, and the body does not have the client_id/client_secret, return [null, null].

function getBasicAuthCredentials(bool $allowInBody = true): array
$allowInBody = truebool
returnsarray

getCharset()

Route.php:269
function getCharset(): string
returnsstringthe response's charset if one is set; otherwise the request's 'charset' attribute (setFormat), falling back to content negotiation (negotiateCharset) against ['utf-8', 'ISO-8859-1'].

getClassMiddleware($obj)

Route.php:773
function getClassMiddleware(object $obj): array
$objobject
returnsarrayevery registered [$obj, 'method']-style middleware callable bound to $obj (removeClassMiddleware for the matching constraint).

getContentType()

Route.php:261
function getContentType(): ?string
returnsnull | stringthe response's Content-Type (media type only, no charset/params), or null if no response is set yet.

getExtension()

Route.php:332
function getExtension(): ?string
returnsnull | stringthe request URI's file extension (e.g. 'json' for '/api/users.json').

getFormat()

Route.php:281
function getFormat(): string
returnsstringthe response's format (file extension, e.g. 'json') if one is set; otherwise the request's 'format' attribute (setFormat), falling back to the URI's own extension, falling back to 'txt' for a ShellRequest or 'html' otherwise.

getMiddlewareParameters($middleware)

Route.php:697
function getMiddlewareParameters(callable $middleware): ?array
$middlewarecallable
returnsnull | arraythe middleware's current parameters, or null if $middleware isn't registered.

getMiddlewarePriority($middleware)

Route.php:672
function getMiddlewarePriority(callable $middleware): ?int
$middlewarecallable
returnsnull | intthe middleware's current $order (addMiddleware), or null if $middleware isn't registered.

getMiddlewares()

Route.php:737
function getMiddlewares(): array
returnsarray[middleware, parameters, order][], in the order they will actually run (addMiddleware's $order).

getRequest()

Route.php:308
function getRequest(): Psr\Http\Message\ServerRequestInterface
returnsServerRequestInterfacethe current request.

getRequestBody()

Route.php:319
function getRequestBody(): object|array|null
returnsobject | array | nullthe request's parsed body (ServerRequestInterface::getParsedBody).

getResponseBody()

Route.php:234

Get response's parsed body

function getResponseBody(): object|array
returnsobject | array
throwsif no response has been set yet.

getUri($unlock)

Route.php:327
function getUri(bool $unlock = false): Psr\Http\Message\UriInterface
$unlock = falseboolforwarded to the request's own getUri().
returnsUriInterfacethe request's URI.

getVerbosity()

tLogEmitter.php:38
function getVerbosity(): int
returnsintthe current verbosity, as a bitmask of iLogLevel::* constants
$this->getVerbosity() === (iLogLevel::ERROR_PLUS); // true if only errors/critical/alert/emergency are enabled

handle($request)

Route.php:601
function handle(?Psr\Http\Message\ServerRequestInterface $request = null): MMO\core\interfaces\iResponse
See
RequestHandlerInterface::handle Run every registered middleware in order (nextMiddleware/addMiddleware's $order), applying each one's parameters as request attributes before calling it, and folding its return value into the response (an array/\ArrayAccess is merged in via addContent, an iResponse replaces it via setResponse, and null/no return just continues) -- until none are left, or one of them calls stop.
$request = nullnull | ServerRequestInterfaceif given, replaces the current request (setRequest) before running.
returnsiResponse
throwsif a middleware returns something other than an array/\ArrayAccess/iResponse/null.
throwsif no middleware ever set a response.

has($key, $where)

Route.php:362
function has($key, int $where = -1): bool
$key
$where = -1inta IN_QUERY/IN_BODY/... bitmask of where to look.
returnsboolwhether $key was found anywhere in $where. NOTE: internally builds a bitmask of every location $key was actually found in, but the declared bool return type coerces it down to a plain true/false (PHP's weak typing coerces any non-zero int to true) -- so which specific location(s) matched is computed but never actually observable by the caller.

hasAttribute($key)

Route.php:392
function hasAttribute(string $key): bool
$keystring
returnsboolwhether the request attribute $key is set (and not null).

info($message, $context)

tLogEmitter.php:204

Interesting events. No-op if INFO is currently filtered out by the verbosity mask.

function info(Stringable|string $message, array $context = []): voidExample: User logs in, SQL logs.
$messageStringable | string
$context = []array
returnsvoid
$this->info('routing [{request}] ...', ['request' => $request]);

isDelete()

Route.php:101
function isDelete(): bool
returnsboolwhether the current request's method is DELETE.

isGet()

Route.php:86
function isGet(): bool
returnsboolwhether the current request's method is GET.

isHead()

Route.php:96
function isHead(): bool
returnsboolwhether the current request's method is HEAD.

isPost()

Route.php:91
function isPost(): bool
returnsboolwhether the current request's method is POST.

isPut()

Route.php:106
function isPut(): bool
returnsboolwhether the current request's method is PUT.

log($level, $message, $context)

tLogEmitter.php:81

Logs with an arbitrary level.

function log($level, Stringable|string $message, array $context = []): voidNOTE: $level is filtered against the current [`setVerbosity()`](https://mmoframework.fr/documentation/mmo.core/php/server/Route.md#route-setverbosity): if the level is masked out, nothing is logged/dispatched at all. Return type is `void` (not the dispatched Log) to satisfy \Psr\Log\LoggerInterface.
$level
$messageStringable | string
$context = []arrayignored if $message is a Log
returnsvoid
$this->log(self::ERROR, 'disk usage at {percent}%.', ['percent' => 92]); $this->log('error', $caughtException); //string levels are resolved through \MMO\core\debug\flags()

negotiateCharset($supported, $default)

Route.php:500

Negotiates charset with the user's browser through the Accept-Charset HTTP header.

function negotiateCharset(array $supported, ?string $default = null): stringQuality factors in the Accept-Charset: header are supported, e.g.: Accept-Language: en-UK;q=0.7, en-US;q=0.6, no, dk;q=0.8
$supportedarraya list of supported charset
$default = nullnull | stringThe default charset to use if none is found.
returnsstringThe negotiated charset result or the supplied default.

negotiateLanguage($supported, $default)

Route.php:479

Negotiates language with the user's browser through the Accept-Language HTTP header or the user's host address. Language codes are generally in the form "ll" for a language spoken in only one country, or "ll-CC" for a language spoken in a particular country. For example, U.S. English is "en-US", while British English is "en-UK". Portugese as spoken in Portugal is "pt-PT", while Brazilian Portugese is "pt-BR".

function negotiateLanguage(array $supported, ?string $default = null): stringQuality factors in the Accept-Language: header are supported, e.g.: Accept-Language: en-UK;q=0.7, en-US;q=0.6, no, dk;q=0.8
$supportedarraya list of supported languages
$default = nullnull | stringThe default language to use if none is found.
returnsstringThe negotiated language result or the supplied default.

negotiateMimeType($supported, $default)

Route.php:521

Negotiates content type with the user's browser through the Accept HTTP header.

function negotiateMimeType(array $supported, ?string $default = null): stringQuality factors in the Accept: header are supported, e.g.: Accept: application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8
$supportedarraya list of supported MIME types.
$default = nullnull | stringThe default type to use if no match.
returnsstringThe negotiated MIME type result or the supplied default.

nextMiddleware()

Route.php:791
function nextMiddleware(): ?array
returnsnull | array[middleware, parameters, order] for the next middleware to run (handle), or null once none are left.

notice($message, $context)

tLogEmitter.php:187

Normal but significant events. No-op if NOTICE is currently filtered out by the verbosity mask.

function notice(Stringable|string $message, array $context = []): void
$messageStringable | string
$context = []array
returnsvoid
$this->notice('-- START -- ({mode}): {time}', ['mode' => MMO_MODE, 'time' => date('r')]);

redirect($redirectUri, $headers, $post, $status, $reason)

Route.php:575

Stop the route with a redirect response (Response::Redirect).

function redirect( string $redirectUri, ?array $headers = null, ?array $post = null, int $status = 302, string $reason = '' ): MMO\core\interfaces\iResponse
$redirectUristring
$headers = nullnull | arraydefaults to the current response's headers (if any), or [] otherwise.
$post = nullnull | arrayif not null, submits a form instead of using a Location header (Response::Redirect).
$status = 302int
$reason = ''string
returnsiResponsethe redirect response (also set as this route's response and returned by handle).

removeClassMiddleware($obj)

Route.php:760

Remove every registered middleware bound to $obj -- i.e. every middleware added as an array-style callable [$obj, 'method']; a middleware added as a Closure or a plain function name is never matched (and matching one throws, since $obj can't be indexed) -- only use this on routes whose middlewares are all object methods.

function removeClassMiddleware(object $obj): self
$objobject
returnsself

setAttribute($key, $value)

Route.php:375
function setAttribute(string $key, mixed $value): self
$keystring
$valuemixeda request attribute to set, or (if null) remove.
returnsself

setController($controller)

Route.php:412
function setController(MMO\core\interfaces\iModule $controller): static
$controlleriModulestored as the 'controller' request attribute.
returnsstatic

setErrorHandler($handler)

Route.php:634

Add an handler for errors

function setErrorHandler(?callable $handler): void
$handlernull | callablefunction(\Throwable $exception, Route $route): iResponse
returnsvoid

setFormat($format, $charset)

Route.php:297

Set the request's 'format'/'charset' attributes (getFormat/getCharset), and, if a response is already set, update its Content-Type header to match (makeContentTypeHeader).

function setFormat(string $format, string $charset = 'utf-8'): self
$formatstringa file extension, e.g. 'json'.
$charset = 'utf-8'string
returnsself

setMiddlewareOrder($middleware, $order)

Route.php:684
function setMiddlewareOrder(callable $middleware, int $order): self
$middlewarecallablemust be === the exact callable passed to addMiddleware.
$orderintthe new priority -- LOWER runs first, HIGHER runs later (addMiddleware).
returnsself

setRequest($request)

Route.php:313
function setRequest(Psr\Http\Message\ServerRequestInterface $request): self
$requestServerRequestInterfacereplaces the current request.
returnsself

setResponse($response)

Route.php:221
function setResponse(?MMO\core\interfaces\iResponse $response): self
$responsenull | iResponsereplaces the current response (null clears it). No-op if it's already the current response.
returnsself

setVerbosity($verb)

tLogEmitter.php:64

Set the current verbosity mask, replacing whatever it was before.

function setVerbosity(string|int|null $verb = null): void
$verb = nullstring | int | nulla bitmask of iLogLevel::* constants, or a level name/expression resolved through \MMO\core\debug\flags() (e.g. 'error+' for iLogLevel::ERROR_PLUS)
returnsvoid
$this->setVerbosity(iLogLevel::WARNING_PLUS); // only log warnings and above $this->setVerbosity('all'); // log everything

stop($response)

Route.php:584

Stop processing further middlewares (clearMiddlewares), optionally setting the final response first.

function stop(?MMO\core\interfaces\iResponse $response = null): ?MMO\core\interfaces\iResponse
$response = nullnull | iResponseif given, becomes the response (setResponse) before stopping.
returnsnull | iResponsethe response after this call (whatever was set so far, possibly still null).

stopPropagation()

tStoppableEvent.php:29

Prevent any remaining listener in the current dispatch chain from being called.

function stopPropagation()
returns

testVerbosity($level)

tLogEmitter.php:50

Test whether a given level (or set of levels) is currently enabled by this instance's verbosity mask.

function testVerbosity(string|int $level): int
$levelstring | inta iLogLevel::* constant/bitmask, or a level name resolved through \MMO\core\debug\flags()
returnsintthe bits of $level that are currently enabled (0 if none of them are)
$this->testVerbosity(self::DEBUG); // non-zero if debug-level logging is currently enabled $this->testVerbosity('error'); // same, using the string form

warning($message, $context)

tLogEmitter.php:172

Exceptional occurrences that are not errors. No-op if WARNING is currently filtered out by the verbosity mask.

function warning(Stringable|string $message, array $context = []): voidExample: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
$messageStringable | string
$context = []array
returnsvoid
$this->warning('{count} logs were dropped.', ['count' => 3]);

withAttributes($attrs)

Route.php:381
function withAttributes(array $attrs): self
$attrsarraymerged into the request's existing attributes.
returnsself

__clone()

tStoppableEvent.php:38

A cloned event starts fresh: propagation is never considered stopped on the clone, even if it was on the original instance.

function __clone()
returns
Inherited members (32)
ConstantsDeclared byDescription
ALERTiLogLevelAlert: Action must be taken immediately.
ALLiLogLevelMask for all
ALL_PLUSiLogLeveldebug everything
BACKTRACEiLogLevel
CRITICALiLogLevelCritical: Critical conditions.
DEBUGiLogLevelDebug: Detailed debug information.
DEEPiLogLeveldebug everything with arguments
EMERGENCYiLogLevelEmergency: System is unusable.
ERRORiLogLevelError: Runtime errors that do not require immediate action but should typically be logged and monitored.
ERROR_PLUSiLogLevelMask for all error
FATALiLogLevelMask for all fatal error
INFOiLogLevelInfo: Interesting events.
INFO_PLUSiLogLevelMask for all errors/warning/notices/info
MEMORYiLogLevelinclude backtrace object
NOTICEiLogLevelNotice: Normal but significant events.
NOTICE_PLUSiLogLevelMask for all errors/warning/notices/info
TRACEiLogLevelinclude backtrace as origins
WARNINGiLogLevelWarning: Exceptional occurrences that are not errors.
WARNING_PLUSiLogLevelMask for all errors and warnings
PropertiesDeclared byDescription
ListenersEvent
originEvent
MethodsDeclared byDescription
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).
__construct($origin)Event