public function createResolver()
    {
        $resolver = $this->getResolver();
        if (isset($resolver)) {
            $resolver_class = get_class($resolver);

        // Create new retriever.
        $retriever = $resolver->getUriRetriever();
            if (isset($retriever)) {
                $retriever_class = get_class($retriever);
                $new_retriever = new $retriever_class();
            } else {
                $new_retriever = new UriRetriever();
            }

        // Store max depth before init since maxDepth is set on the parent.
        $max_depth = $resolver::$maxDepth;

        // Create new resolver.
        $new_resolver = new $resolver_class($new_retriever);

        // Sync public static properties.
        $new_resolver::$maxDepth = $max_depth;
        } else {
            $new_retriever = new UriRetriever();
            $new_resolver = new RefResolver($new_retriever);
        }

        return $new_resolver;
    }