public function returnMiddleware(App $app, array $objects, array $middleware)
    {
        if (isset($middleware['arguments'])) {
            $params = $middleware['arguments'];
            $count = count($params);
        } else {
            $count = 0;
        }
        foreach ($params as $k => $v) {
            if (preg_match("#.#", $v)) {
                $explode = explode(".", $v);
                if (isset($objects[$explode[0]])) {
                    if (count($explode) >= 2) {
                        $param = $explode[1];
                        $params[$k] = $objects[$explode[0]]->$param;
                    } else {
                        $params[$k] = $objects[$explode[0]];
                    }
                }
            }
        }
        if (isset($middleware['middleware'])) {
            if ($count == 1) {
                return (new $middleware['middleware']($params[0]));
            } elseif ($count == 2) {
                return (new $middleware['middleware']($params[0], $params[1]));
            } else {
                return (new $middleware['middleware']());
            }
        } else {
            return ($params[0]);
        }
    }