Skip to content

Commit 8f81765

Browse files
author
Wazabii
committed
With DOM
1 parent 28ea437 commit 8f81765

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

SwiftRender.php

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
namespace PHPFuse\Output;
1111

1212
use PHPFuse\Container\Interfaces\ContainerInterface;
13-
use Exception;
13+
use Exception, BadMethodCallException;
1414

1515
use PHPFuse\DTO\Format\Str;
1616
use PHPFuse\DTO\Traverse;
17-
//use PHPFuse\Output\Dom\Document;
18-
//use PHPFuse\Output\Dom\Element;
17+
use PHPFuse\Output\Dom\Document;
18+
use PHPFuse\Output\Dom\Element;
1919

2020
class SwiftRender {
2121

@@ -422,6 +422,26 @@ private function existAtGet(string $key): bool
422422
return (bool)(isset($this->{$key}) && $this->get === $key);
423423
}
424424

425+
function dom(string $key): Document
426+
{
427+
return Document::dom($key);
428+
}
429+
function createTag(string $element, string $value, ?array $attr = NULL) {
430+
$inst = new Document();
431+
$el = $inst->create($element, $value)->attrArr($attr);
432+
return $el;
433+
}
434+
435+
function isDoc($el): bool
436+
{
437+
return (bool)($el instanceof Document || $el instanceof Element);
438+
}
439+
440+
function isEl($el): bool
441+
{
442+
return (bool)($el instanceof Element);
443+
}
444+
425445
/*
426446
function dom(string $key): Document
427447
{

0 commit comments

Comments
 (0)