forms/mappers/JsonInputMapper.php
2024-05-28 17:10:06 +03:00

36 lines
1.0 KiB
PHP
Executable File

<?php
namespace itguild\forms\form\mappers;
use itguild\forms\form\builders\ButtonBuilder;
use itguild\forms\form\builders\CheckBoxBuilder;
use itguild\forms\form\builders\HiddenBuilder;
use itguild\forms\form\builders\RadioButtonBuilder;
use itguild\forms\form\builders\SelectBuilder;
use itguild\forms\form\builders\TextAreaBuilder;
use itguild\forms\form\builders\TextInputBuilder;
class JsonInputMapper
{
private static function getBuilders(): array
{
return [
"textInput" => TextInputBuilder::class,
"textArea" => TextAreaBuilder::class,
"radio" => RadioButtonBuilder::class,
"select" => SelectBuilder::class,
"button" => ButtonBuilder::class,
"checkbox" => CheckBoxBuilder::class,
"hidden" => HiddenBuilder::class,
];
}
public static function getBuilder(string $type): string
{
if(isset(self::getBuilders()[$type])){
return self::getBuilders()[$type];
}
return false;
}
}