@@ -82,7 +82,8 @@ public function getContainer(): ContainerInterface
8282
8383 /**
8484 * Set a default file ending (".php" is pre defined)
85- * @param self
85+ * @param string $ending
86+ * @return self
8687 */
8788 public function setFileEnding (string $ ending ): self
8889 {
@@ -93,7 +94,8 @@ public function setFileEnding(string $ending): self
9394 /**
9495 * Customize template file.
9596 * (Call this if you want to bind for multiple file to same partial)
96- * @param self
97+ * @param string $file
98+ * @return self
9799 */
98100 public function setFile (string $ file ): self
99101 {
@@ -151,7 +153,7 @@ public function setPartialDir(string $dir): self
151153
152154 /**
153155 * Create a index view
154- * @param string $file Filename
156+ * @param string|callable $file Filename
155157 * @return self
156158 */
157159 public function setIndex (string |callable $ file ): self
@@ -178,7 +180,7 @@ public function setBuffer(string $output): self
178180
179181 /**
180182 * Create a Main view
181- * @param string $file Filename
183+ * @param string|callable $file Filename
182184 * @param array $args Pass on argummets to template
183185 * @return self
184186 */
@@ -207,9 +209,9 @@ public function withView(string $file, array $args = array()): self
207209
208210 /**
209211 * Create a partial view
210- * @param string $keyA Filename/key
211- * @param array $keyB Args/filename
212- * @param array $keyC Args
212+ * @param string $keyA Filename/key
213+ * @param string| array $keyB Args/filename
214+ * @param array $keyC Args
213215 */
214216 public function setPartial (string $ keyA , string |array $ keyB = array (), array $ keyC = array ()): self
215217 {
@@ -257,10 +259,11 @@ public function bindToBody(string $key, array $bindArr, array $args = array()):
257259
258260 /**
259261 * IF find in specified Bind Array the it will return the view
260- * @param string|int|float $find
261- * @return [type] [description]
262+ * @param string|int $find
263+ * @param bool $overwrite
264+ * @return void
262265 */
263- public function findBind ($ find , bool $ overwrite = false ): void
266+ public function findBind (string | int $ find , bool $ overwrite = false ): void
264267 {
265268 if (!is_null ($ this ->bindArr ) && ($ overwrite || is_null ($ this ->bindView ))) {
266269 foreach ($ this ->bindArr as $ get => $ arr ) {
@@ -275,7 +278,7 @@ public function findBind($find, bool $overwrite = false): void
275278
276279 /**
277280 * Prepare index for return
278- * @param boolean $args Overwrite arguments
281+ * @param array|null $args Overwrite arguments
279282 * @return self
280283 */
281284 public function index (?array $ args = null ): self
@@ -380,7 +383,7 @@ private function buildView(): void
380383 * Build and Contain template and data until it's executed,
381384 * this means that code is prepared and will not take any extra memory if view would not be called.
382385 * So you can if you want prepare a bunch of partial views and just call the the ones you want
383- * @param string $file the filename
386+ * @param string|callable $file the filename
384387 * @param array $args Pass arguments to template
385388 * @return callable
386389 */
@@ -398,7 +401,7 @@ private function build(string|callable $file, array $args = array()): callable
398401 }
399402 } else {
400403 $ filePath = "{$ dir }{$ file }. {$ this ->ending }" ;
401- if (is_string ( $ filePath ) && is_file ($ filePath )) {
404+ if (is_file ($ filePath )) {
402405 if (is_array ($ argsFromFile ) && count ($ argsFromFile ) > 0 ) {
403406 $ args = $ argsFromFile ;
404407 }
@@ -424,7 +427,7 @@ private function build(string|callable $file, array $args = array()): callable
424427 */
425428 public function partialExists ($ key ): bool
426429 {
427- return ( bool ) isset ($ this ->partial [$ key ]);
430+ return isset ($ this ->partial [$ key ]);
428431 }
429432
430433 /**
@@ -434,7 +437,7 @@ public function partialExists($key): bool
434437 */
435438 public function exists (string $ key ): bool
436439 {
437- return (bool )( in_array ($ key , $ this ::VIEWS ) && isset ($ this ->{$ key }));
440+ return (in_array ($ key , $ this ::VIEWS ) && isset ($ this ->{$ key }));
438441 }
439442
440443 /**
@@ -444,7 +447,7 @@ public function exists(string $key): bool
444447 */
445448 private function existAtGet (string $ key ): bool
446449 {
447- return (bool )( isset ($ this ->{$ key }) && $ this ->get === $ key );
450+ return (isset ($ this ->{$ key }) && $ this ->get === $ key );
448451 }
449452
450453 /**
@@ -464,20 +467,25 @@ public function dom(string $key): Document
464467 {
465468 return Document::dom ($ key );
466469 }
470+
467471 public function createTag (string $ element , string $ value , ?array $ attr = null )
468472 {
469473 $ inst = new Document ();
470- $ elem = $ inst ->create ($ element , $ value )->attrArr ($ attr );
474+ $ elem = $ inst ->create ($ element , $ value );
475+ if (!($ elem instanceof Element)) {
476+ throw new \Exception ("Could not find connection to Element instance " , 1 );
477+ }
478+ $ elem = $ elem ->attrArr ($ attr );
471479 return $ elem ;
472480 }
473481
474482 public function isDoc ($ elem ): bool
475483 {
476- return (bool )( $ elem instanceof Document || $ elem instanceof Element);
484+ return ($ elem instanceof Document || $ elem instanceof Element);
477485 }
478486
479487 public function isEl ($ elem ): bool
480488 {
481- return (bool )( $ elem instanceof Element);
489+ return ($ elem instanceof Element);
482490 }
483491}
0 commit comments