@@ 14-32 (lines=19) @@ | ||
11 | * Class Br |
|
12 | * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/br |
|
13 | */ |
|
14 | final class Br extends AbstractElement |
|
15 | { |
|
16 | public function __construct(AttributeSet $attributes = null) |
|
17 | { |
|
18 | $this->attributes = $attributes ?? new AttributeSet(); |
|
19 | $this->tag = new EmptyTag('br', $attributes); |
|
20 | } |
|
21 | ||
22 | public function withAttribute(string $name, string $value = null): Br |
|
23 | { |
|
24 | if ($value) { |
|
25 | $attribute = new StandardAttribute($name, $value); |
|
26 | } else { |
|
27 | $attribute = new BooleanAttribute($name); |
|
28 | } |
|
29 | ||
30 | return new Br($this->attributes->add($attribute)); |
|
31 | } |
|
32 | } |
|
33 |
@@ 14-37 (lines=24) @@ | ||
11 | * Class Column |
|
12 | * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/col |
|
13 | */ |
|
14 | final class Column extends AbstractElement |
|
15 | { |
|
16 | public function __construct(AttributeSet $attributes = null) |
|
17 | { |
|
18 | $this->attributes = $attributes ?? new AttributeSet(); |
|
19 | $this->tag = new EmptyTag('col', $attributes); |
|
20 | } |
|
21 | ||
22 | public function withAttribute(string $name, string $value = null): Column |
|
23 | { |
|
24 | if ($value) { |
|
25 | $attribute = new StandardAttribute($name, $value); |
|
26 | } else { |
|
27 | $attribute = new BooleanAttribute($name); |
|
28 | } |
|
29 | ||
30 | return new Column($this->attributes->add($attribute)); |
|
31 | } |
|
32 | ||
33 | public function withSpan(int $span = 1): Column |
|
34 | { |
|
35 | return $this->withAttribute('span', $span); |
|
36 | } |
|
37 | } |
|
38 |
@@ 14-32 (lines=19) @@ | ||
11 | * Class Hr |
|
12 | * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hr |
|
13 | */ |
|
14 | final class Hr extends AbstractElement |
|
15 | { |
|
16 | public function __construct(AttributeSet $attributes = null) |
|
17 | { |
|
18 | $this->attributes = $attributes ?? new AttributeSet(); |
|
19 | $this->tag = new EmptyTag('hr', $attributes); |
|
20 | } |
|
21 | ||
22 | public function withAttribute(string $name, string $value = null): Hr |
|
23 | { |
|
24 | if ($value) { |
|
25 | $attribute = new StandardAttribute($name, $value); |
|
26 | } else { |
|
27 | $attribute = new BooleanAttribute($name); |
|
28 | } |
|
29 | ||
30 | return new Hr($this->attributes->add($attribute)); |
|
31 | } |
|
32 | } |
|
33 |
@@ 14-32 (lines=19) @@ | ||
11 | * Class WordBreak |
|
12 | * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/wbr |
|
13 | */ |
|
14 | final class WordBreak extends AbstractElement |
|
15 | { |
|
16 | public function __construct(AttributeSet $attributes = null) |
|
17 | { |
|
18 | $this->attributes = $attributes ?? new AttributeSet(); |
|
19 | $this->tag = new EmptyTag('wbr', $attributes); |
|
20 | } |
|
21 | ||
22 | public function withAttribute(string $name, string $value = null): WordBreak |
|
23 | { |
|
24 | if ($value) { |
|
25 | $attribute = new StandardAttribute($name, $value); |
|
26 | } else { |
|
27 | $attribute = new BooleanAttribute($name); |
|
28 | } |
|
29 | ||
30 | return new WordBreak($this->attributes->add($attribute)); |
|
31 | } |
|
32 | } |
|
33 |