src/DI/CallableResolver.php
public function resolve($toResolve)
    {
        if (\is_callable($toResolve)) {
            return $toResolve;
        }

        if (!\is_string($toResolve)) {
            $this->assertCallable($toResolve);
        }

        // check for slim callable as "class:method"
        if (preg_match(self::CALLABLE_PATTERN, $toResolve, $matches)) {
            $resolved = $this->resolveCallable($matches[1], $matches[2]);
            $this->assertCallable($resolved);

            return $resolved;
        }

        $resolved = $this->resolveCallable($toResolve);
        $this->assertCallable($resolved);

        return $resolved;
    }
public function resolve($toResolve)
    {
        if (\is_callable($toResolve)) {
            return $toResolve;
        }

        if (!\is_string($toResolve)) {
            $this->assertCallable($toResolve);
        }

        // check for slim callable as "class:method"
        if (preg_match(self::CALLABLE_PATTERN, $toResolve, $matches)) {
            $resolved = $this->resolveCallable($matches[1], $matches[2]);
            $this->assertCallable($resolved);

            return $resolved;
        }

        $resolved = $this->resolveCallable($toResolve);
        $this->assertCallable($resolved);

        return $resolved;
    }
public function resolve ( $ toResolve ) { if ( \ is_callable ( $ toResolve ) ) { return $ toResolve ; } if ( ! \ is_string ( $ toResolve ) ) { $ this -> assertCallable ( $ toResolve ) ; } // check for slim callable as "class:method" if ( preg_match ( self :: CALLABLE_PATTERN , $ toResolve , $ matches ) ) { $ resolved = $ this -> resolveCallable ( $ matches [ 1 ] , $ matches [ 2 ] ) ; $ this -> assertCallable ( $ resolved ) ; return $ resolved ; } $ resolved = $ this -> resolveCallable ( $ toResolve ) ; $ this -> assertCallable ( $ resolved ) ; return $ resolved ; }
Resolve toResolve into a closure that 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'.

@param mixed $toResolve

@return callable

@throws RuntimeException if the callable does not exist
@throws RuntimeException if the callable is not resolvable
Resolve toResolve into a closure that that the router can dispatch .