W3cubDocs

/Laravel 8

BoundMethod

class BoundMethod (View source)

Methods

static mixed call(Container $container, callable|string $callback, array $parameters = [], string|null $defaultMethod = null)

Call the given Closure / class@method and inject its dependencies.

static mixed callClass(Container $container, string $target, array $parameters = [], string|null $defaultMethod = null)

Call a string reference to a class using Class@method syntax.

static mixed callBoundMethod(Container $container, callable $callback, mixed $default)

Call a method that has been bound to the container.

static string normalizeMethod(callable $callback)

Normalize the given callback into a Class@method string.

static array getMethodDependencies(Container $container, callable|string $callback, array $parameters = [])

Get all dependencies for a given method.

static ReflectionFunctionAbstract getCallReflector(callable|string $callback)

Get the proper reflection instance for the given callback.

static void addDependencyForCallParameter(Container $container, ReflectionParameter $parameter, array $parameters, array $dependencies)

Get the dependency for the given call parameter.

static bool isCallableWithAtSign(mixed $callback)

Determine if the given string is in Class@method syntax.

Details

static mixed call(Container $container, callable|string $callback, array $parameters = [], string|null $defaultMethod = null)

Call the given Closure / class@method and inject its dependencies.

Parameters

Container $container
callable|string $callback
array $parameters
string|null $defaultMethod

Return Value

mixed

Exceptions

ReflectionException
InvalidArgumentException

static protected mixed callClass(Container $container, string $target, array $parameters = [], string|null $defaultMethod = null)

Call a string reference to a class using Class@method syntax.

Parameters

Container $container
string $target
array $parameters
string|null $defaultMethod

Return Value

mixed

Exceptions

InvalidArgumentException

static protected mixed callBoundMethod(Container $container, callable $callback, mixed $default)

Call a method that has been bound to the container.

Parameters

Container $container
callable $callback
mixed $default

Return Value

mixed

static protected string normalizeMethod(callable $callback)

Normalize the given callback into a Class@method string.

Parameters

callable $callback

Return Value

string

static protected array getMethodDependencies(Container $container, callable|string $callback, array $parameters = [])

Get all dependencies for a given method.

Parameters

Container $container
callable|string $callback
array $parameters

Return Value

array

Exceptions

ReflectionException

static protected ReflectionFunctionAbstract getCallReflector(callable|string $callback)

Get the proper reflection instance for the given callback.

Parameters

callable|string $callback

Return Value

ReflectionFunctionAbstract

Exceptions

ReflectionException

static protected void addDependencyForCallParameter(Container $container, ReflectionParameter $parameter, array $parameters, array $dependencies)

Get the dependency for the given call parameter.

Parameters

Container $container
ReflectionParameter $parameter
array $parameters
array $dependencies

Return Value

void

static protected bool isCallableWithAtSign(mixed $callback)

Determine if the given string is in Class@method syntax.

Parameters

mixed $callback

Return Value

bool

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/8.x/Illuminate/Container/BoundMethod.html