src/Application.php
protected function convertCallbackToClosure($callback, $namespace)
    {
        if ($callback instanceof Closure || is_callable($callback)) {
            return $callback;
        } elseif (is_string($callback)) {
            $namespace = rtrim($namespace, '\\').'\\';
            $arrCallback = explode('::', $callback);
            $isStaticCall = count($arrCallback) == 2;
            if ($isStaticCall) {
                $className = $namespace.$arrCallback[0];
                return [$className, $arrCallback[1]];
            } else {
                $arrCallback = explode(':', $callback);
                $className = $namespace.$arrCallback[0];
                // Must be replaced with a safer way to instantiate an object
                $obj = $this->container->get($className);
                return [$obj, $arrCallback[1]];
            }
        }
    }
protected function convertCallbackToClosure($callback, $namespace)
    {
        if ($callback instanceof Closure || is_callable($callback)) {
            return $callback;
        } elseif (is_string($callback)) {
            $namespace = rtrim($namespace, '\\').'\\';
            $arrCallback = explode('::', $callback);
            $isStaticCall = count($arrCallback) == 2;
            if ($isStaticCall) {
                $className = $namespace.$arrCallback[0];
                return [$className, $arrCallback[1]];
            } else {
                $arrCallback = explode(':', $callback);
                $className = $namespace.$arrCallback[0];
                // Must be replaced with a safer way to instantiate an object
                $obj = $this->container->get($className);
                return [$obj, $arrCallback[1]];
            }
        }
    }
protected function convertCallbackToClosure ( $ callback , $ namespace ) { if ( $ callback instanceof Closure || is_callable ( $ callback ) ) { return $ callback ; } elseif ( is_string ( $ callback ) ) { $ namespace = rtrim ( $ namespace , '\\' ) . '\\' ; $ arrCallback = explode ( '::' , $ callback ) ; $ isStaticCall = count ( $ arrCallback ) == 2 ; if ( $ isStaticCall ) { $ className = $ namespace . $ arrCallback [ 0 ] ; return [ $ className , $ arrCallback [ 1 ] ] ; } else { $ arrCallback = explode ( ':' , $ callback ) ; $ className = $ namespace . $ arrCallback [ 0 ] ; // Must be replaced with a safer way to instantiate an object $ obj = $ this -> container -> get ( $ className ) ; return [ $ obj , $ arrCallback [ 1 ] ] ; } } }
Converts callback to Closure.

@param string|Closure $callback
@param string         $namespace

@return Closure
Converts callback to Closure .