Overview
  • Namespace
  • Class

Namespaces

  • Slim
    • Exception
    • Handlers
      • Strategies
    • Http
    • Interfaces
      • Http

Classes

  • App
  • CallableResolver
  • Collection
  • Container
  • DefaultServicesProvider
  • DeferredCallable
  • Routable
  • Route
  • RouteGroup
  • Router

Traits

  • CallableResolverAwareTrait
  • MiddlewareAwareTrait

Class CallableResolver

This class resolves a string of the format 'class:method' into a closure that can be dispatched.

Slim\CallableResolver implements Slim\Interfaces\CallableResolverInterface
Final
Namespace: Slim
Located at CallableResolver.php

Methods summary

public
# __construct( Psr\Container\ContainerInterface $container )

Parameters

$container
public callable
# resolve( mixed $toResolve )

Resolve toResolve into a closure so that the router can dispatch.

Resolve toResolve into a closure so that the router can dispatch.

If toResolve is of the format 'class:method', then try to extract 'class' from the container otherwise instantiate it and then dispatch 'method'.

Parameters

$toResolve

Returns

callable

Throws

RuntimeException
if the callable does not exist
RuntimeException
if the callable is not resolvable

Implementation of

Slim\Interfaces\CallableResolverInterface::resolve()
protected callable
# resolveCallable( string $class, string $method = '__invoke' )

Check if string is something in the DIC that's callable or is a class name which has an __invoke() method.

Check if string is something in the DIC that's callable or is a class name which has an __invoke() method.

Parameters

$class
$method

Returns

callable

Throws

RuntimeException
if the callable does not exist
protected
# assertCallable( Callable $callable )

Parameters

$callable

Throws

RuntimeException
if the callable is not resolvable

Constants summary

string CALLABLE_PATTERN
# '!^([^\:]+)\:([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)$!'
API documentation generated by ApiGen