Callback Functions
Nette\Utils\Callback is a static class, which contains functions for working with PHP callbacks.
Installation:
All examples assume the following class alias is defined:
check($callable, bool $syntax=false): callable
Checks that $callable
is valid PHP callback. Otherwise throws Nette\InvalidArgumentException
. If the
$syntax
is set to true, the function only verifies that $callable
has a valid structure to be used as a
callback, but does not verify if the class or method actually exists. Returns $callable
.
toString($callable): string
Converts PHP callback to textual form. Class or method may not exists.
toReflection($callable): ReflectionMethod|ReflectionFunction
Returns reflection for method or function used in PHP callback.
isStatic($callable): bool
Checks whether PHP callback is function or static method.
unwrap(Closure $closure): callable|array
Unwraps closure created by Closure::fromCallable
.