diff --git a/app/src/Domain/Entity/Episode/File.php b/app/src/Domain/Entity/Episode/File.php index 2e980eb..9630a03 100644 --- a/app/src/Domain/Entity/Episode/File.php +++ b/app/src/Domain/Entity/Episode/File.php @@ -2,11 +2,17 @@ namespace Slovocast\Domain\Entity\Episode; +use Slovocast\Domain\Entity as EntityTrait; + /** * Represents the file for the episode itself. */ class File { + use EntityTrait; + + private string $buffer = ""; + public function __construct( private string $url, private int $length, @@ -27,4 +33,40 @@ class File { return $this->type; } + + public function setBuffer(string $buffer): void + { + $this->buffer = $buffer; + } + + public function getBuffer(): string + { + return $this->buffer; + } + + /** + * @param array $props Properties and their values. + */ + public static function fromArray(array $props): File + { + $file = new self( + $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; + } } diff --git a/app/src/Domain/Repository/Episode/EpisodeFileRepositoryInterface.php b/app/src/Domain/Repository/Episode/EpisodeFileRepositoryInterface.php new file mode 100644 index 0000000..7838747 --- /dev/null +++ b/app/src/Domain/Repository/Episode/EpisodeFileRepositoryInterface.php @@ -0,0 +1,16 @@ +