Skip to content

Commit

Permalink
Move Builder::class to ui-awesome/html-helper. (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Mar 6, 2024
1 parent 7c50940 commit 2f187d0
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 400 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

## 0.1.1 Under development

## 0.1.0 February 23, 2024
## 0.1.0 March 6, 2024

- Initial release.
- Bug #2: Refactor `README.md` to improve organization and headings for better readability (@terabytesoftw)
- Bug #3: Update badges in `README.md` (@terabytesoftw)
- Enh #4: Move `Builder::class` to `ui-awesome/html-helper` (@terabytesoftw)
51 changes: 0 additions & 51 deletions docs/Builder.md

This file was deleted.

9 changes: 0 additions & 9 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@

The **HTML** repository is a powerful tool for generating `HTML` code using `PHP`.

## Creating Widgets

The repository also provides a `Builder::class` class that you can use to generate `HTML` code programmatically using
`PHP`.

## Builder class

- [Builder](/docs/Builder.md)

## List of Tags

### Generic
Expand Down
8 changes: 4 additions & 4 deletions src/Base/AbstractBlockElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
Attribute\HasLang,
Attribute\HasStyle,
Attribute\HasTitle,
Builder,
Concern\HasAttributes,
Concern\HasContent,
Helper\HTMLBuilder
};

/**
Expand Down Expand Up @@ -42,7 +42,7 @@ public function begin(): string
{
parent::begin();

return Builder::beginTag($this->tagName, $this->attributes);
return HTMLBuilder::beginTag($this->tagName, $this->attributes);
}

/**
Expand All @@ -53,9 +53,9 @@ public function begin(): string
protected function run(): string
{
if ($this->isBeginExecuted() === false) {
return Builder::createTag($this->tagName, $this->content, $this->attributes);
return HTMLBuilder::createTag($this->tagName, $this->content, $this->attributes);
}

return Builder::endTag($this->tagName);
return HTMLBuilder::endTag($this->tagName);
}
}
203 changes: 0 additions & 203 deletions src/Base/AbstractBuilder.php

This file was deleted.

6 changes: 3 additions & 3 deletions src/Base/AbstractElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
Attribute\HasLang,
Attribute\HasStyle,
Attribute\HasTitle,
Builder,
Concern\HasAttributes,
Concern\HasPrefixCollection,
Concern\HasSuffixCollection,
Concern\HasTemplate,
Helper\HTMLBuilder,
Helper\Template,
Interop\RenderInterface
};
Expand Down Expand Up @@ -60,7 +60,7 @@ protected function buildElement(string $tagName, string $content = '', array $to
{
$tokenTemplateValues = [
'{prefix}' => $this->renderTag($this->prefixAttributes, $this->prefix, $this->prefixTag),
'{tag}' => Builder::createTag($tagName, $content, $this->attributes),
'{tag}' => HTMLBuilder::createTag($tagName, $content, $this->attributes),
'{suffix}' => $this->renderTag($this->suffixAttributes, $this->suffix, $this->suffixTag),
];
$tokenTemplateValues += $tokenValues;
Expand All @@ -74,6 +74,6 @@ private function renderTag(array $attributes, string $content, false|string $tag
return $content;
}

return Builder::createTag($tag, $content, $attributes);
return HTMLBuilder::createTag($tag, $content, $attributes);
}
}
14 changes: 0 additions & 14 deletions src/Builder.php

This file was deleted.

8 changes: 4 additions & 4 deletions src/FormControl/Base/AbstractForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
Attribute\HasRel,
Attribute\HasStyle,
Attribute\HasTitle,
Builder,
Concern\HasAttributes,
Concern\HasContent,
FormControl\Input\Hidden,
Helper\HTMLBuilder,
Helper\Validator
};

Expand Down Expand Up @@ -77,7 +77,7 @@ public function begin(): string

$hiddenInputs = $this->renderHiddenInput();

$html = Builder::beginTag('form', $this->attributes);
$html = HTMLBuilder::beginTag('form', $this->attributes);

if ($hiddenInputs !== '') {
$html .= "\n$hiddenInputs";
Expand Down Expand Up @@ -183,10 +183,10 @@ protected function run(): string
$html = "$hiddenInputs\n";
}

return Builder::createTag('form', $html . $this->content, $this->attributes);
return HTMLBuilder::createTag('form', $html . $this->content, $this->attributes);
}

return Builder::endTag('form');
return HTMLBuilder::endTag('form');
}

private function renderHiddenInput(): string
Expand Down
Loading

0 comments on commit 2f187d0

Please sign in to comment.