Skip to content

Commit 6f12260

Browse files
author
Wazabii
committed
Structural improvement
1 parent a4bf93a commit 6f12260

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Dom/Document.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,9 @@ public function createPrepend(string $element, ?string $value = null, ?string $b
108108
if (is_null($this->elements)) {
109109
$this->elements = array();
110110
}
111-
112111
if (!is_null($bind)) {
113-
$new[$bind] = $inst;
114-
$this->elements = array_merge($new, $this->elements);
112+
//$new[$bind] = $inst;
113+
$this->elements = array_merge([$bind => $inst], $this->elements);
115114
} else {
116115
$this->elements = array_merge([$inst], $this->elements);
117116
}

Json.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ private function select(string $key)
253253
*/
254254
final protected static function encodeData(array $json, int $flag = JSON_UNESCAPED_UNICODE, int $depth = 512): ?string
255255
{
256+
if (!($depth > 0 && $depth <= 2147483647)) {
257+
throw new \Exception("The json encode depth need to be min 1 and max 2147483647!", 1);
258+
}
256259
if (count($json) > 0 && ($encode = json_encode($json, $flag, $depth))) {
257260
return $encode;
258261
}

SwiftRender.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public function setView(string|callable $file, array $args = array()): self
198198
* Keep prev view immutable and create a new one.
199199
* @param string $file [description]
200200
* @param array $args [description]
201-
* @return static
201+
* @return self
202202
*/
203203
public function withView(string $file, array $args = array()): self
204204
{
@@ -411,7 +411,8 @@ private function build(string|callable $file, array $args = array()): callable
411411
}
412412
}
413413
} else {
414-
throw new Exception("You need to call @" . str_replace("_", "", $this->get) .
414+
$file = (is_string($file)) ? $file : "[Callable]";
415+
throw new Exception("You need to call @" . str_replace("_", "", (string)$this->get) .
415416
"DIR and specify dir path for {$file}.", 1);
416417
}
417418
};

0 commit comments

Comments
 (0)