src/Template.php
public function &getTagRef($tag)
    {
        if ($this->isTopTag($tag)) {
            return $this->template;
        }

        $a = explode('#', $tag);
        $tag = array_shift($a);
        //$ref = array_shift($a); // unused
        if (!isset($this->tags[$tag])) {
            throw $this->exception('Tag not found in Template')
                ->addMoreInfo('tag', $tag)
                ->addMoreInfo('tags', implode(', ', array_keys($this->tags)));
        }

        // return first array element only
        reset($this->tags[$tag]);
        $key = key($this->tags[$tag]) !== null ? key($this->tags[$tag]) : null;

        return $this->tags[$tag][$key];
    }
public function &getTagRef($tag)
    {
        if ($this->isTopTag($tag)) {
            return $this->template;
        }

        $a = explode('#', $tag);
        $tag = array_shift($a);
        //$ref = array_shift($a); // unused
        if (!isset($this->tags[$tag])) {
            throw $this->exception('Tag not found in Template')
                ->addMoreInfo('tag', $tag)
                ->addMoreInfo('tags', implode(', ', array_keys($this->tags)));
        }

        // return first array element only
        reset($this->tags[$tag]);
        $key = key($this->tags[$tag]) !== null ? key($this->tags[$tag]) : null;

        return $this->tags[$tag][$key];
    }
public function & getTagRef ( $ tag ) { if ( $ this -> isTopTag ( $ tag ) ) { return $ this -> template ; } $ a = explode ( '#' , $ tag ) ; $ tag = array_shift ( $ a ) ; //$ref = array_shift($a); // unused if ( ! isset ( $ this -> tags [ $ tag ] ) ) { throw $ this -> exception ( 'Tag not found in Template' ) -> addMoreInfo ( 'tag' , $ tag ) -> addMoreInfo ( 'tags' , implode ( ', ' , array_keys ( $ this -> tags ) ) ) ; } // return first array element only reset ( $ this -> tags [ $ tag ] ) ; $ key = key ( $ this -> tags [ $ tag ] ) !== null ? key ( $ this -> tags [ $ tag ] ) : null ; return $ this -> tags [ $ tag ] [ $ key ] ; }
This is a helper method which returns reference to element of template
array referenced by a said tag.

Because there might be multiple tags and getTagRef is
returning only one template, it will return the first
occurrence:

{greeting}hello{/},  {greeting}world{/}

calling &getTagRef('greeting') will return reference to &array('hello');

@param string $tag

@return &array
This is a helper method which returns reference to element of template array referenced by a said tag .