src/WorkerF/Http/Route.php
protected static function _runDispatch(Requests $request, $callback, $middleware_symbols, $params = [])
    {
        // check route middlewares
        $request = self::_checkMiddleware($request, $middleware_symbols);
        // if middlewares check is not passed
        if ( ! ($request instanceof Requests)) {
            return $request;
        }

        // is class
        if (is_string($callback)) {
            // syntax check
            if ( ! preg_match('/^[a-zA-Z0-9_\\\\]+@[a-zA-Z0-9_]+$/', $callback)) {
                throw new \LogicException("Please use controller@method define callback");
            }
            // get controller method info
            $controller = explode('@', $callback);
            list($class, $method) = [$controller[0], $controller[1]];
            // class methods exist ?
            if ( ! class_exists($class) || ! method_exists($class, $method)) {
                $e = new \BadMethodCallException("Class@method: $callback is not found!");
                $e->httpCode = 404;
                throw $e;
            }
            // call method
            return IOCContainer::run($class, $method, $params);
        }
        // is callback
        if (is_callable($callback)) {
            // call function
            return call_user_func_array($callback, $params);
        }
    }
protected static function _runDispatch(Requests $request, $callback, $middleware_symbols, $params = [])
    {
        // check route middlewares
        $request = self::_checkMiddleware($request, $middleware_symbols);
        // if middlewares check is not passed
        if ( ! ($request instanceof Requests)) {
            return $request;
        }

        // is class
        if (is_string($callback)) {
            // syntax check
            if ( ! preg_match('/^[a-zA-Z0-9_\\\\]+@[a-zA-Z0-9_]+$/', $callback)) {
                throw new \LogicException("Please use controller@method define callback");
            }
            // get controller method info
            $controller = explode('@', $callback);
            list($class, $method) = [$controller[0], $controller[1]];
            // class methods exist ?
            if ( ! class_exists($class) || ! method_exists($class, $method)) {
                $e = new \BadMethodCallException("Class@method: $callback is not found!");
                $e->httpCode = 404;
                throw $e;
            }
            // call method
            return IOCContainer::run($class, $method, $params);
        }
        // is callback
        if (is_callable($callback)) {
            // call function
            return call_user_func_array($callback, $params);
        }
    }
run dispatch.

@param WorkerF\Http\Requests $request
@param mixed $callback string or Closure
@param array $middleware_symbols
@param array $params
@return mixed
@throws \LogicException
@throws \BadMethodCallException
@throws \InvalidArgumentException