picea/src/ControlStructure/EndSectionToken.php
Dave Mc Nicoll bcd49884fc - WIP on RAW token
- WIP on caching interface
- Work done on easing template rendering for the controller
2019-10-04 08:38:11 -04:00

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?>";
}
}