<commit_before><?php

namespace RoyallTheFourth\HtmlDocument\Element;

use RoyallTheFourth\HtmlDocument\Attribute\BooleanAttribute;
use RoyallTheFourth\HtmlDocument\Attribute\StandardAttribute;
use RoyallTheFourth\HtmlDocument\Set\AttributeSet;
use RoyallTheFourth\HtmlDocument\Set\ElementSet;

/**
 * Class Article
 * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/article
 */
final class Article extends AbstractElement
{
    public function __construct(AttributeSet $attributes = null, ElementSet $children = null)
    {
        $this->attributes = $attributes ?? new AttributeSet();
        $this->children = $children ?? new ElementSet();
    }

    public function render(): string
    {
        $attributes = $this->renderAttributes();
        $children = $this->renderChildren();

        return "<article{$attributes}>{$children}\n</article>\n";
    }

    public function withAttribute(string $name, string $value = null): Anchor
    {
        if($value) {
            $attribute = new StandardAttribute($name, $value);
        }else{
            $attribute = new BooleanAttribute($name);
        }

        return new Anchor($this->attributes->add($attribute));
    }

    public function withChild(ElementInterface $element): Anchor
    {
        return new Anchor($this->attributes, $this->children->add($element));
    }

}<commit_msg>Add article element type<commit_after><?php

namespace RoyallTheFourth\HtmlDocument\Element;

use RoyallTheFourth\HtmlDocument\Attribute\BooleanAttribute;
use RoyallTheFourth\HtmlDocument\Attribute\StandardAttribute;
use RoyallTheFourth\HtmlDocument\Set\AttributeSet;
use RoyallTheFourth\HtmlDocument\Set\ElementSet;

/**
 * Class Article
 * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/article
 */
final class Article extends AbstractElement
{
    public function __construct(AttributeSet $attributes = null, ElementSet $children = null)
    {
        $this->attributes = $attributes ?? new AttributeSet();
        $this->children = $children ?? new ElementSet();
    }

    public function render(): string
    {
        $attributes = $this->renderAttributes();
        $children = $this->renderChildren();

        return "<article{$attributes}>{$children}\n</article>\n";
    }

    public function withAttribute(string $name, string $value = null): Article
    {
        if($value) {
            $attribute = new StandardAttribute($name, $value);
        }else{
            $attribute = new BooleanAttribute($name);
        }

        return new Article($this->attributes->add($attribute));
    }

    public function withChild(ElementInterface $element): Article
    {
        return new Article($this->attributes, $this->children->add($element));
    }

}
{'fraction_non_alphanumeric': 0.126775956284153, 'fraction_numerical': 0.0, 'mean_word_length': 3.4869281045751634, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 25, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3675799', 'n_tokens_mistral': 746, 'n_tokens_neox': 712, 'n_words': 153}