public function resolve($template)
    {
        $namespace = self::DEFAULT_NAMESPACE;
        if (preg_match('#^(?P<namespace>[^:]+)::(?P<template>.*)$#', $template, $matches)) {
            $namespace = $matches['namespace'];
            $template  = $matches['template'];
        }

        $segments = explode($this->getSeparator(), $template);
        $template = implode('/', $segments) . $this->getSuffix();

        $path = $this->fetchTemplateForNamespace($template, $namespace);

        if ($path !== false || $namespace === self::DEFAULT_NAMESPACE) {
            return $path;
        }

        return $this->fetchTemplateForNamespace($template, self::DEFAULT_NAMESPACE);
    }