Skip to content

Commit dce2772

Browse files
author
Wazabii
committed
Argumnet patch
1 parent 72027d9 commit dce2772

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

SwiftRender.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ class SwiftRender
2929
private $partial;
3030
private $get;
3131
private $arg; // Default args
32-
private $arguments; // Merge with defualt args
3332
private $dir;
3433
private $bind;
3534
private $bindView;
3635
private $bindArr;
3736
private $container;
37+
//private $arguments; // Removed
3838

3939
/**
4040
* Used to build output buffer;
@@ -347,9 +347,11 @@ final public function get(?array $args = null): string
347347
$output = $this->{$this->get};
348348

349349
// Will merge/replace arguments with current/deafult arguments
350+
/*
350351
if (is_array($args)) {
351352
$args = array_merge($this->arguments, $args);
352353
}
354+
*/
353355

354356
ob_start();
355357
if (!is_null($this->arg)) {
@@ -399,7 +401,7 @@ private function buildView(): void
399401
*/
400402
private function build(string|callable $file, array $args = array()): callable
401403
{
402-
$this->arguments = $args;
404+
//$this->arguments = $args;
403405
$func = function ($argsFromFile) use ($file, $args) {
404406
if (($dir = ($this->dir[$this->get] ?? null)) || !is_null($dir)) {
405407
if (is_callable($file)) {
@@ -421,13 +423,12 @@ private function build(string|callable $file, array $args = array()): callable
421423
$filePath = realpath("{$dir}{$file}.{$this->ending}");
422424
if (is_file($filePath)) {
423425
if (is_array($argsFromFile) && count($argsFromFile) > 0) {
424-
$args = $argsFromFile;
426+
$args = array_merge($args, $argsFromFile);
425427
}
426428
$this->inclRouterFileData($filePath, Traverse::value($args), $args);
427429
break;
428430

429431
} else {
430-
431432
$missingFiles[] = $file;
432433
}
433434
}
@@ -486,6 +487,7 @@ private function existAtGet(string $key): bool
486487
*/
487488
private function inclRouterFileData(string $filePath, object $obj, array $args): void
488489
{
490+
//extract($args);
489491
include($filePath);
490492
}
491493

0 commit comments

Comments
 (0)