. */ declare(strict_types=1); namespace App\Services\InfoProviderSystem\DTOs; class ParameterDTO { public function __construct( public readonly string $name, public readonly ?string $value_text = null, public readonly ?float $value_typ = null, public readonly ?float $value_min = null, public readonly ?float $value_max = null, public readonly ?string $unit = null, public readonly ?string $symbol = null, public readonly ?string $group = null, ) { } public static function parseValueField(string $name, string|float $value, ?string $unit = null, ?string $symbol = null, ?string $group = null): self { if (is_float($value) || is_numeric($value)) { return new self($name, value_typ: (float) $value, unit: $unit, symbol: $symbol); } return new self($name, value_text: $value, unit: $unit, symbol: $symbol, group: $group); } }