Overview

Namespaces

  • Charcoal
    • App
      • Action
      • Config
      • Handler
      • Middleware
      • Module
      • Route
      • Script
      • ServiceProvider
      • Template

Classes

  • App
  • AppConfig
  • AppContainer

Interfaces

  • AppAwareInterface

Traits

  • AppAwareTrait
  • CallableResolverAwareTrait
  • Overview
  • Namespace
  • Class

Trait CallableResolverAwareTrait

Resolve Callable

This trait enables the resolution of 'class:method' strings into a closure. This class is based on \Slim\CallableResolverAwareTrait Slim's trait.

The resolver will attempt checks on the current class, an optional alternate object, the DI container.

Can resolve the following string formats:

  • 'class:method'
  • 'parent:method'
  • 'static:method'
  • 'self:method' or ':method'
Namespace: Charcoal\App
Located at Charcoal/App/CallableResolverAwareTrait.php
Methods summary
protected Charcoal\App\CallableResolverAwareTrait
# setCallableResolver( Slim\Interfaces\CallableResolverInterface $resolver )

Set a callable resolver.

Set a callable resolver.

Parameters

$resolver
A callable resolver.

Returns

Charcoal\App\CallableResolverAwareTrait
protected Closure
# resolveCallable( callable|string $callable, object|null $context = null )

Resolve a string of the format 'class:method' into a closure that the router can dispatch.

Resolve a string of the format 'class:method' into a closure that the router can dispatch.

Parameters

$callable
A callable function or method, either as a reference or string.
$context
Optional. An additional context under to test $callable as a method.

Returns

Closure

Throws

RuntimeException

If the string cannot be resolved as a callable or the resolver was not previously set.

Properties summary
protected static array $resolvedCallableCache

The cache of string-based callables.

The cache of string-based callables.

# []
protected string $callablePattern

A regular expression for matching 'class:method' callable strings.

A regular expression for matching 'class:method' callable strings.

# '!^([^\:]+)?\:([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)$!'
protected Slim\Interfaces\CallableResolverInterface $callableResolver

Store the callable resolver.

Store the callable resolver.

#
API documentation generated by ApiGen