tWithRoutes
MMO\core\classes · 1 symbol · generated 5 Oct 2026
tWithRoutes
tWithRoutes.php:23Gives a controller class (any class with methods decorated with #[APIRoute(...)], e.g. an aController) convenient static access to its own routes as registered in the running Application: looking a route up by method name, building a URL for it, or turning it into a Link.
- Namespace
MMO\core\classes
Index
| ExtractRoutes($config) static | Extract all the APIRoute from this class, regardless of the fact they are registered in the application | |
| HasRoutes() static | Tells if any APIRoute are registered in the application | |
| Link($method, $data) static | Build a Link (URL + label/icon/description/title, taken from the route's APIRoute metadata) for a registered route. | |
| Route($method) static | Get a registered APIRoute WARNING: if this class was not registered in the application, it will return null. | |
| Routes() static | Get a list of registered APIRoutes (from this class) in the application WARNING: if this class was not registered in the application, it will return an empty array. | |
| Url($method, $data) static | Build the URL for a registered route, filling in any {placeholder} from $data. |
Methods6
ExtractRoutes($config)
statictWithRoutes.php:92Extract all the APIRoute from this class, regardless of the fact they are registered in the application
HasRoutes()
statictWithRoutes.php:52Tells if any APIRoute are registered in the application
| returns | bool |
Link($method, $data)
statictWithRoutes.php:78Build a Link (URL + label/icon/description/title, taken from the route's APIRoute metadata) for a registered route.
| $method | string | the name of the method carrying the #[APIRoute] attribute |
| $data = null | null | array | values for the route's URL placeholders |
| returns | Link | |
| throws | if $method has no registered route |
Route($method)
statictWithRoutes.php:43Get a registered APIRoute WARNING: if this class was not registered in the application, it will return null.
Routes()
statictWithRoutes.php:31Get a list of registered APIRoutes (from this class) in the application WARNING: if this class was not registered in the application, it will return an empty array.
| returns | array |
Url($method, $data)
statictWithRoutes.php:64Build the URL for a registered route, filling in any {placeholder} from $data.
| $method | string | the name of the method carrying the #[APIRoute] attribute |
| $data = null | null | array | values for the route's URL placeholders (e.g. {uid} in data.json?uid={uid}) |
| returns | string | |
| throws | if $method has no registered route (either the class or the method is not routed) |