public function generate($name, array $params = [], $absolute = false)
    {
        $config = $this->container->get('Config');

        $path = '';
        if ($config->has('app.basepath')) {
            $path = $config->get('app.basepath');
        }

        $path .= $this->container->get('HttpDispatcher')->generate($name, $params);

        if ($absolute === true) {
            $uristr = (string)$this->request->getUri();

            // get uri up to (but excluding) third slash (http://example.com)
            // it's safe to assume the third slash won't occur within the first 8 chars
            $part = substr($uristr, 0, strpos($uristr, '/', 8));
            $path = $part.$path;
        }

        return $path;
    }