private function extend() {

		if(preg_match($this->extendRex, $this->bufferInstance->__rawContents, $matches)) {

			$blockRegExp = '~<!--\s*\{\s*block\s*:\s*' . $matches[2] . '\s*\}\s*-->~';

			$extendedContent = file_get_contents(Application::getInstance()->getRootPath() . (defined('TPL_PATH') ? str_replace('/', DIRECTORY_SEPARATOR, ltrim(TPL_PATH, '/')) : '') . $matches[1]);

			if(preg_match($blockRegExp, $extendedContent)) {

				$this->bufferInstance->__rawContents = preg_replace(
					$blockRegExp,
					preg_replace(
						$this->extendRex,
						'',
						$this->bufferInstance->__rawContents
					),
					$extendedContent
				);

			}

			else {
				throw new SimpleTemplateException("Could not extend with '{$matches[1]}' at '{$matches[2]}'.", SimpleTemplateException::TEMPLATE_INVALID_NESTING);
			}
		}
	}
private function extend() {

		if(preg_match($this->extendRex, $this->bufferInstance->__rawContents, $matches)) {

			$blockRegExp = '~<!--\s*\{\s*block\s*:\s*' . $matches[2] . '\s*\}\s*-->~';

			$extendedContent = file_get_contents(Application::getInstance()->getRootPath() . (defined('TPL_PATH') ? str_replace('/', DIRECTORY_SEPARATOR, ltrim(TPL_PATH, '/')) : '') . $matches[1]);

			if(preg_match($blockRegExp, $extendedContent)) {

				$this->bufferInstance->__rawContents = preg_replace(
					$blockRegExp,
					preg_replace(
						$this->extendRex,
						'',
						$this->bufferInstance->__rawContents
					),
					$extendedContent
				);

			}

			else {
				throw new SimpleTemplateException("Could not extend with '{$matches[1]}' at '{$matches[2]}'.", SimpleTemplateException::TEMPLATE_INVALID_NESTING);
			}
		}
	}
private function extend ( ) { if ( preg_match ( $ this -> extendRex , $ this -> bufferInstance -> __rawContents , $ matches ) ) { $ blockRegExp = '~<!--\s*\{\s*block\s*:\s*' . $ matches [ 2 ] . '\s*\}\s*-->~' ; $ extendedContent = file_get_contents ( Application :: getInstance ( ) -> getRootPath ( ) . ( defined ( 'TPL_PATH' ) ? str_replace ( '/' , DIRECTORY_SEPARATOR , ltrim ( TPL_PATH , '/' ) ) : '' ) . $ matches [ 1 ] ) ; if ( preg_match ( $ blockRegExp , $ extendedContent ) ) { $ this -> bufferInstance -> __rawContents = preg_replace ( $ blockRegExp , preg_replace ( $ this -> extendRex , '' , $ this -> bufferInstance -> __rawContents ) , $ extendedContent ) ; } else { throw new SimpleTemplateException ( "Could not extend with '{$matches[1]}' at '{$matches[2]}'." , SimpleTemplateException :: TEMPLATE_INVALID_NESTING ) ; } } }
allow extension of a parent template with current template

searches in current rawContents for
<!-- { extend: parent_template.php @ content_block } -->
and in template to extend for
<!-- { block: content_block } -->

current rawContents is then replaced by parent rawContents with current rawContents filled in

@throws SimpleTemplateException
@throws \vxPHP\Application\Exception\ApplicationException
allow extension of a parent template with current template