Merge branch 'master' of https://git.mcnd.ca/mcndave/picea
This commit is contained in:
commit
af212b07ca
72 files changed
+1362
-391
No files matched your search
@@ -8,10 +8,13 @@ namespace %NAMESPACE%;
|
||||
if (! class_exists("%NAMESPACE%\%CLASSNAME%", false) ) {
|
||||
|
||||
class %CLASSNAME% %EXTENDS% {
|
||||
|
||||
public array $blockList = [];
|
||||
|
||||
public array $sectionList = [];
|
||||
|
||||
public array $sectionStack = [];
|
||||
|
||||
public array $variableList = [];
|
||||
|
||||
public ?object $thisProxy = null;
|
||||
@@ -24,6 +27,8 @@ if (! class_exists("%NAMESPACE%\%CLASSNAME%", false) ) {
|
||||
|
||||
public bool $renderingInsideSection = false;
|
||||
|
||||
public int $depth = 0;
|
||||
|
||||
public function __construct(\Picea\Picea $picea, array $variablesList = [], ?object $thisProxy = null) {
|
||||
$this->picea = $picea;
|
||||
$this->variableList = $variablesList;
|
||||
@@ -37,15 +42,26 @@ if (! class_exists("%NAMESPACE%\%CLASSNAME%", false) ) {
|
||||
|
||||
public function output(array $variablesList = []) : void
|
||||
{
|
||||
$__event = new \Picea\Builder\ClassTemplateEvent();
|
||||
|
||||
$this->rendering = true;
|
||||
|
||||
( function($___class__template, $___global_variables, $___variables, $picea) {
|
||||
$this->depth++;
|
||||
|
||||
$__event->eventExecute(\Picea\Event\Builder\ClassTemplateOutputing::class, $variablesList);
|
||||
|
||||
( function($___class__template, $___global_variables, $___variables, $__event, $picea) {
|
||||
extract($___global_variables);
|
||||
extract($___variables, \EXTR_OVERWRITE);
|
||||
?>%CONTENT%<?php
|
||||
} )->call($this->thisProxy ?? new class(){}, $this, $this->variableList, $variablesList, $this->picea);
|
||||
} )->call($this->thisProxy ?? new class() {}, $this, $this->variableList, $variablesList, $__event, $this->picea);
|
||||
|
||||
$__event->eventExecute(\Picea\Event\Builder\ClassTemplateOutputDone::class, $variablesList);
|
||||
|
||||
%PARENT_OUTPUT%
|
||||
|
||||
$this->depth--;
|
||||
|
||||
$this->rendering = false;
|
||||
}
|
||||
|
||||
@@ -85,6 +101,14 @@ if (! class_exists("%NAMESPACE%\%CLASSNAME%", false) ) {
|
||||
|
||||
public static function getSourceLineFromException(int $sourceLine) : ? int
|
||||
{
|
||||
$selfSource = file_get_contents(__FILE__);
|
||||
|
||||
foreach(explode("\n", $selfSource) as $line => $content) {
|
||||
if ( strpos($content, str_replace('$', '%', '/*$EXCEPTION_LINE_BASE$*/')) !== false ) {
|
||||
return $sourceLine - $line;
|
||||
}
|
||||
}
|
||||
|
||||
$sourceFile = file_get_contents("%TEMPLATE%");
|
||||
|
||||
if ( $sourceFile ) {
|
||||
|
||||
Reference in new issue
Block a user