Загрузить файлы в «src/inputs»
This commit is contained in:
parent
7e593b9116
commit
bdd51bad90
33
src/inputs/TextInput.php
Normal file
33
src/inputs/TextInput.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace src\inputs;
|
||||
|
||||
use src\traits\CreateParams;
|
||||
|
||||
class TextInput
|
||||
{
|
||||
|
||||
use CreateParams;
|
||||
private string $name;
|
||||
|
||||
private array $paramsArray;
|
||||
|
||||
public function __construct(string $name, array $paramsArray = [])
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->paramsArray = $paramsArray;
|
||||
}
|
||||
|
||||
public function create(): void
|
||||
{
|
||||
$paramsString = $this->createParams($this->paramsArray);
|
||||
echo "<input name='$this->name' $paramsString >";
|
||||
}
|
||||
|
||||
public static function build(string $name, array $paramsArray = []): void
|
||||
{
|
||||
$input = new self($name, $paramsArray);
|
||||
$input->create();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user