This commit is contained in:
kali
2024-03-15 14:17:25 +03:00
commit 000e0acfb8
13 changed files with 492 additions and 0 deletions

55
src/inputs/Select.php Normal file
View File

@ -0,0 +1,55 @@
<?php
namespace src\inputs;
use src\traits\CreateOption;
use src\traits\CreateParams;
class Select
{
use CreateParams;
use CreateOption;
private $name;
private $options;
private $value;
private $paramsArray;
/**
* @param string $name
* @param array $options
* @param $value
* @param array $paramsArray
*/
public function __construct(string $name, array $options = [], $value = null, array $paramsArray = [])
{
$this->name = $name;
$this->options = $options;
$this->value = $value;
$this->paramsArray = $paramsArray;
}
/**
* @return void
*/
public function create(): void
{
$paramsString = $this->createParams($this->paramsArray);
$optionsString = $this->createOption($this->options, $this->value);
echo "<select name='$this->name' $paramsString>$optionsString</select>";
}
/**
* @param string $name
* @param array $options
* @param $value
* @param array $paramsArray
* @return void
*/
public static function build(string $name, array $options = [], $value = null, array $paramsArray = []): void
{
$textarea = new self($name, $options, $value, $paramsArray);
$textarea->create();
}
}