Add a file factory

This commit is contained in:
Dave Smith-Hayes 2025-04-16 22:17:40 -04:00
parent e59b1ea2d1
commit 551d5043c1

View File

@ -0,0 +1,37 @@
<?php
namespace Slovocast\Domain\Factory;
use Slovocast\Domain\Entity\Episode\File;
use Slovocast\Domain\FactoryInterface;
class FileFactory implements FactoryInterface
{
public static function fromArray(array $props): File
{
$file = new File(
$props['url'],
(int) $props['length'],
$props['type']
);
if ($props['id']) {
$file->setId($props['id']);
}
if ($props['createAt']) {
$file->setCreatedAt($props['createdAt']);
}
if ($props['updatedAt']) {
$file->setUpdatedAt($props['updatedAt']);
}
return $file;
}
public static function toArray(File $file): array
{
return [];
}
}