Phrozn\Site\View\Base::parse PHP Method

parse() private method

Parses input file into front matter and actual template content
private parse ( ) : Phrozn\Site\View
return Phrozn\Site\View
    private function parse()
    {
        if (isset($this->template, $this->frontMatter)) {
            return $this;
        }
        $source = $this->readSourceFile();
        $parts = preg_split('/[\\n]*[-]{3}[\\n]/', $source, 2);
        if (count($parts) === 2) {
            $this->frontMatter = Yaml::parse($parts[0]);
            $this->template = trim($parts[1]);
        } else {
            $this->frontMatter = array();
            $this->template = trim($source);
        }
        return $this;
    }