public function produce()
    {
        $result = $this->template;
        $regex = sprintf('~%s([\w\.]+)%s~m', $this->placeholderStart, $this->placeholderEnd);

        $matched = preg_match_all($regex, $result, $matches, PREG_SET_ORDER);
        if (!$matched) {
            return $result;
        }

        foreach ($matches as $match) { // fill in placeholders
            $placeholder = $match[1];
            $value = $this->vars;
            foreach (explode('.', $placeholder) as $segment) {
                if (is_array($value) && array_key_exists($segment, $value)) {
                    $value = $value[$segment];
                } else {
                    continue 2;
                }
            }

            $result = str_replace($this->placeholderStart . $placeholder . $this->placeholderEnd, $value, $result);
        }
        return $result;
    }
public function produce()
    {
        $result = $this->template;
        $regex = sprintf('~%s([\w\.]+)%s~m', $this->placeholderStart, $this->placeholderEnd);

        $matched = preg_match_all($regex, $result, $matches, PREG_SET_ORDER);
        if (!$matched) {
            return $result;
        }

        foreach ($matches as $match) { // fill in placeholders
            $placeholder = $match[1];
            $value = $this->vars;
            foreach (explode('.', $placeholder) as $segment) {
                if (is_array($value) && array_key_exists($segment, $value)) {
                    $value = $value[$segment];
                } else {
                    continue 2;
                }
            }

            $result = str_replace($this->placeholderStart . $placeholder . $this->placeholderEnd, $value, $result);
        }
        return $result;
    }
public function produce ( ) { $ result = $ this -> template ; $ regex = sprintf ( '~%s([\w\.]+)%s~m' , $ this -> placeholderStart , $ this -> placeholderEnd ) ; $ matched = preg_match_all ( $ regex , $ result , $ matches , PREG_SET_ORDER ) ; if ( ! $ matched ) { return $ result ; } foreach ( $ matches as $ match ) { // fill in placeholders $ placeholder = $ match [ 1 ] ; $ value = $ this -> vars ; foreach ( explode ( '.' , $ placeholder ) as $ segment ) { if ( is_array ( $ value ) && array_key_exists ( $ segment , $ value ) ) { $ value = $ value [ $ segment ] ; } else { continue 2 ; } } $ result = str_replace ( $ this -> placeholderStart . $ placeholder . $ this -> placeholderEnd , $ value , $ result ) ; } return $ result ; }
Fills up template string with placed variables.

@return mixed
Fills up template string with placed variables .