/**
  * @param string $template Relative path to the template.
  *
  * @return string
  * @throws RuntimeException Throws if template has incorrect format or template could not be found.
  */
 protected function getTemplatePath($template)
 {
     $parts = explode('/', $template);
     if (count($parts) < 1) {
         throw new RuntimeException("Template path [{$template}] has incorrect format, it is must start from theme-name or alias path");
     }
     $extracted = array_splice($parts, 0, 1);
     $alias = $extracted[0];
     if (!array_key_exists($alias, $this->templateConfig)) {
         $alias = $this->wp->wp_get_theme()->template;
         array_unshift($parts, $extracted[0]);
     }
     $fullTemplatePath = rtrim($this->templateConfig[$alias], '/') . '/' . join('/', $parts);
     if (!file_exists($fullTemplatePath)) {
         throw new RuntimeException("Could not found template [{$fullTemplatePath}] please check requested template name");
     }
     return $fullTemplatePath;
 }