mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 09:18:54 +00:00
45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Services\AdultProcessing;
|
|
|
|
/**
|
|
* Value object containing release information for adult movie processing.
|
|
*/
|
|
class AdultReleaseContext
|
|
{
|
|
public function __construct(
|
|
public readonly int $releaseId,
|
|
public readonly string $searchName,
|
|
public readonly string $cleanTitle,
|
|
public readonly ?string $guid = null,
|
|
) {}
|
|
|
|
/**
|
|
* Create from a Release model array/object.
|
|
*/
|
|
public static function fromRelease(array|object $release, string $cleanTitle): self
|
|
{
|
|
$data = is_array($release) ? $release : (array) $release;
|
|
|
|
return new self(
|
|
releaseId: (int) ($data['id'] ?? 0),
|
|
searchName: $data['searchname'] ?? '',
|
|
cleanTitle: $cleanTitle,
|
|
guid: $data['guid'] ?? null,
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Create from a movie title string.
|
|
*/
|
|
public static function fromTitle(string $title): self
|
|
{
|
|
return new self(
|
|
releaseId: 0,
|
|
searchName: $title,
|
|
cleanTitle: $title,
|
|
guid: null,
|
|
);
|
|
}
|
|
}
|