mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-04 07:22:34 +00:00
* wip * wip * cleanup * notification channels * phpstan * services * remove server types * refactoring * refactoring
35 lines
610 B
PHP
35 lines
610 B
PHP
<?php
|
|
|
|
namespace App\DTOs;
|
|
|
|
readonly class DynamicForm
|
|
{
|
|
/**
|
|
* @param array<int, DynamicField> $fields
|
|
*/
|
|
public function __construct(
|
|
private array $fields = [],
|
|
) {}
|
|
|
|
/**
|
|
* @param array<int, DynamicField> $fields
|
|
*/
|
|
public static function make(array $fields): self
|
|
{
|
|
return new self($fields);
|
|
}
|
|
|
|
/**
|
|
* @return array<int, mixed>
|
|
*/
|
|
public function toArray(): array
|
|
{
|
|
$fields = [];
|
|
foreach ($this->fields as $field) {
|
|
$fields[] = $field->toArray();
|
|
}
|
|
|
|
return $fields;
|
|
}
|
|
}
|