- WIP on caching interface - Work done on easing template rendering for the controller
		
			
				
	
	
		
			19 lines
		
	
	
		
			611 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			611 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace Picea\ControlStructure;
 | |
| 
 | |
| class EndSectionToken implements ControlStructure {
 | |
| 
 | |
|     public string $token = "endsection";
 | |
| 
 | |
|     public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
 | |
|         if ( empty($context->sections) ) {
 | |
|             throw new \RuntimeException("A section closing tag {% endsection %} was found without an opening {% section %} tag");
 | |
|         }
 | |
| 
 | |
|         $section = array_pop($context->sections);
 | |
|         $build = $context->extendFrom ? "" : "\$this->__renderSection({$section['name']});";
 | |
|         return "<?php }]; $build?>";
 | |
|     }
 | |
| }
 |