NNTmux /
newznab-tmux
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Services\AdultProcessing; |
||
| 4 | |||
| 5 | /** |
||
| 6 | * Value object containing release information for adult movie processing. |
||
| 7 | */ |
||
| 8 | class AdultReleaseContext |
||
| 9 | { |
||
| 10 | public function __construct( |
||
| 11 | public readonly int $releaseId, |
||
| 12 | public readonly string $searchName, |
||
| 13 | public readonly string $cleanTitle, |
||
| 14 | public readonly ?string $guid = null, |
||
| 15 | ) {} |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Create from a Release model array/object. |
||
| 19 | */ |
||
| 20 | public static function fromRelease(array|object $release, string $cleanTitle): self |
||
| 21 | { |
||
| 22 | $data = is_array($release) ? $release : (array) $release; |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 23 | |||
| 24 | return new self( |
||
| 25 | releaseId: (int) ($data['id'] ?? 0), |
||
| 26 | searchName: $data['searchname'] ?? '', |
||
| 27 | cleanTitle: $cleanTitle, |
||
| 28 | guid: $data['guid'] ?? null, |
||
| 29 | ); |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Create from a movie title string. |
||
| 34 | */ |
||
| 35 | public static function fromTitle(string $title): self |
||
| 36 | { |
||
| 37 | return new self( |
||
| 38 | releaseId: 0, |
||
| 39 | searchName: $title, |
||
| 40 | cleanTitle: $title, |
||
| 41 | guid: null, |
||
| 42 | ); |
||
| 43 | } |
||
| 44 | } |
||
| 45 | |||
| 46 |