mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Add helper constructor with variadic
This commit is contained in:
parent
9046f066df
commit
822cf15ac9
@ -25,11 +25,22 @@ final class Element implements Renderable
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
string $name,
|
string $name,
|
||||||
array $attributes,
|
array $attributes,
|
||||||
?array $Components
|
?array $Contents
|
||||||
) {
|
) {
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->attributes = $attributes;
|
$this->attributes = $attributes;
|
||||||
$this->Components = $Components;
|
$this->Contents = $Contents;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $name
|
||||||
|
* @param array<string, string> $attributes
|
||||||
|
* @param Renderable ...$Contents
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function new(string $name, array $attributes, Renderable ...$Contents): self
|
||||||
|
{
|
||||||
|
return new self($name, $attributes, $Contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user