public static function callback($handler)
    {
        if ($handler instanceof Closure) {
            return $handler;
        }
        if (is_object($handler[0])) {
            return $handler;
        }

        // If the first argument is a class name string,
        // then create the controller object.
        if (is_string($handler[0])) {

            // If users define the constructor arguments in options array.
            $constructArgs = [];
            $rc = new ReflectionClass($handler[0]);
            if (isset($options['constructor_args'])) {
                $con = $handler[0] = $rc->newInstanceArgs($constructArgs);
            } else {
                $con = $handler[0] = $rc->newInstance();
            }

            return $handler;
        }

        throw new LogicException('Unsupported handler type');
    }