first commit

This commit is contained in:
Doar Mihai
2026-08-09 20:15:40 +03:00
commit 5301412a2a
165 changed files with 19789 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
<?php
namespace App\Dtos;
class RecipeStepDto
{
public ?int $id = null;
public ?int $stepNumber = null;
public ?string $title = null;
public ?string $instruction = null;
public ?string $image = null;
public ?int $timeEstimate = null;
public ?int $sortOrder = null;
/**
* Create DTO from array
*
* @param array $data
* @return static
*/
public static function fromArray(array $data): static
{
$dto = new static();
$dto->id = $data['id'] ?? null;
$dto->stepNumber = isset($data['stepNumber']) ? (int)$data['stepNumber'] : null;
$dto->title = $data['title'] ?? null;
$dto->instruction = $data['instruction'] ?? null;
$dto->image = $data['image'] ?? null;
$dto->timeEstimate = isset($data['timeEstimate']) ? (int)$data['timeEstimate'] : null;
$dto->sortOrder = isset($data['sortOrder']) ? (int)$data['sortOrder'] : null;
return $dto;
}
/**
* Convert DTO to array
*
* @return array
*/
public function toArray(): array
{
return [
'id' => $this->id,
'stepNumber' => $this->stepNumber,
'title' => $this->title,
'instruction' => $this->instruction,
'image' => $this->image,
'timeEstimate' => $this->timeEstimate,
'sortOrder' => $this->sortOrder,
];
}
}