Skip to content

Commit a29d87a

Browse files
committed
update: To use implementations, unneeded defaults
1 parent 40322ed commit a29d87a

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/Document.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
<?php
2-
32
declare(strict_types=1);
43

54
namespace Eightfold\HTMLBuilder;
65

76
use Stringable;
87

9-
use Eightfold\XMLBuilder\Comment;
108
use Eightfold\XMLBuilder\Contracts\Buildable;
9+
use Eightfold\XMLBuilder\Implementations\Buildable as BuildableImp;
10+
1111
use Eightfold\HTMLBuilder\Element;
1212

1313
class Document implements Buildable
1414
{
15+
use BuildableImp;
16+
1517
/**
1618
* @var array<string|Stringable>
1719
*/
@@ -32,8 +34,8 @@ public static function create(
3234

3335
final private function __construct(
3436
private string $title,
35-
private string $lang = 'en',
36-
private string $charset = 'utf-8'
37+
private string $lang,
38+
private string $charset
3739
) {
3840
}
3941

@@ -49,7 +51,7 @@ public function body(string|Stringable ...$content): Document
4951
return $this;
5052
}
5153

52-
public function build(): string
54+
public function __toString(): string
5355
{
5456
$doctype = '<!doctype html>' . "\n";
5557
return $doctype . Element::html(
@@ -62,11 +64,6 @@ public function build(): string
6264
)->props($this->lang())->build();
6365
}
6466

65-
public function __toString(): string
66-
{
67-
return $this->build();
68-
}
69-
7067
private function title(): string
7168
{
7269
return $this->title;

0 commit comments

Comments
 (0)