HandlerResolver
Utility class to validate and resolve MCP element handlers.
Tags
Table of Contents
Methods
- resolve() : ReflectionMethod|ReflectionFunction
- Validates and resolves a handler to a ReflectionMethod or ReflectionFunction instance.
Methods
resolve()
Validates and resolves a handler to a ReflectionMethod or ReflectionFunction instance.
public
static resolve(Handler $handler) : ReflectionMethod|ReflectionFunction
A handler can be:
- A Closure: function() { ... }
- An array: [ClassName::class, 'methodName'] (resolved on a new or container-provided instance)
- An array: [$instance, 'methodName'] (method on a pre-built object instance)
- An array: [ClassName::class, 'staticMethod'] (static method, if callable)
- A string: InvokableClassName::class (which will resolve to its '__invoke' method)
Parameters
- $handler : Handler
-
the handler to resolve