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(Closure|array{0: string, 1: string}|string $handler) : ReflectionMethod|ReflectionFunction
A handler can be:
- A Closure: function() { ... }
- An array: [ClassName::class, 'methodName'] (instance method)
- An array: [ClassName::class, 'staticMethod'] (static method, if callable)
- A string: InvokableClassName::class (which will resolve to its '__invoke' method)
Parameters
- $handler : Closure|array{0: string, 1: string}|string
-
the handler to resolve