base commit
This commit is contained in:
commit
a794dacd39
345 files changed
+29597
No files matched your search
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\DTOs\Import;
|
||||
|
||||
readonly class VacationRowDto
|
||||
{
|
||||
public function __construct(
|
||||
public string $employeeNumber,
|
||||
public ?string $type,
|
||||
public ?string $startDate,
|
||||
public ?string $endDate,
|
||||
public ?string $returnDate,
|
||||
public ?int $days,
|
||||
public ?string $status,
|
||||
public ?string $reason,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $row
|
||||
*/
|
||||
public static function fromMappedRow(array $row): self
|
||||
{
|
||||
return new self(
|
||||
employeeNumber: (string) ($row['employee_number'] ?? ''),
|
||||
type: self::nullableString($row['type'] ?? null),
|
||||
startDate: self::nullableString($row['start_date'] ?? null),
|
||||
endDate: self::nullableString($row['end_date'] ?? null),
|
||||
returnDate: self::nullableString($row['return_date'] ?? null),
|
||||
days: isset($row['days']) && $row['days'] !== '' ? (int) $row['days'] : null,
|
||||
status: self::nullableString($row['status'] ?? null),
|
||||
reason: self::nullableString($row['reason'] ?? null),
|
||||
);
|
||||
}
|
||||
|
||||
private static function nullableString(mixed $value): ?string
|
||||
{
|
||||
if ($value === null || $value === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (string) $value;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user