base commit

This commit is contained in:
Mekan1206
2026-07-30 17:24:40 +05:00
commit a794dacd39
345 changed files with 29597 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
<?php
declare(strict_types=1);
namespace App\DTOs\Import;
readonly class BonusRowDto
{
public function __construct(
public string $employeeNumber,
public ?string $bonusDate,
public ?string $bonusType,
public ?float $amount,
public ?string $reason,
) {}
/**
* @param array<string, mixed> $row
*/
public static function fromMappedRow(array $row): self
{
return new self(
employeeNumber: (string) ($row['employee_number'] ?? ''),
bonusDate: self::nullableString($row['bonus_date'] ?? null),
bonusType: self::nullableString($row['bonus_type'] ?? null),
amount: isset($row['amount']) && $row['amount'] !== '' ? (float) $row['amount'] : null,
reason: self::nullableString($row['reason'] ?? null),
);
}
private static function nullableString(mixed $value): ?string
{
if ($value === null || $value === '') {
return null;
}
return (string) $value;
}
}