picea = $picea; $this->variableList = $variablesList; $this->thisProxy = $thisProxy; $this->exportFunctions(); static::$context = $picea->context; } public function output(array $variablesList = []) : void { ( function($___class__template, $___global_variables, $___variables, $picea) { extract($___global_variables); extract($___variables, \EXTR_OVERWRITE); ?>%CONTENT%call($this->thisProxy ?? new class(){}, $this, $this->variableList, $variablesList, $this->picea); %PARENT_OUTPUT% } public function renderSection($name) : void { foreach([ 'prepend', 'default', 'append' ] as $item) { usort($this->sectionList[$name][$item], fn($a, $b) => $a['order'] <=> $b['order']); foreach($this->sectionList[$name][$item] as $section) { $section['callback'](); if ( $item === 'default' ) { break 1; } } } } public function exportFunctions() : void { static $caching = []; %FUNCTIONS% } public function getSourceLineFromException(\Throwable $ex) : ? int { $sourceFile = file_get_contents("%TEMPLATE%"); if ( $sourceFile ) { foreach(explode(PHP_EOL, $sourceFile) as $line => $content) { if ( strpos($content, str_replace('$', '%', '$CONTENT$')) !== false ) { return $ex->getLine() - $line; } } } return null; } public function __invoke(array $variablesList = []) : string { ob_start(); $this->output($variablesList); return ob_get_clean(); } } } return [ 'classname' => "%CLASSNAME%", 'namespace' => "%NAMESPACE%", 'extends' => "%EXTENDS_TEMPLATE%", 'view' => "%FULLPATH%" ];