mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
34 lines
768 B
PHP
34 lines
768 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\Data;
|
|
|
|
use Spatie\LaravelData\Data;
|
|
use Spatie\TypeScriptTransformer\Attributes\TypeScript;
|
|
|
|
#[TypeScript]
|
|
final class BookParseResult extends Data
|
|
{
|
|
public function __construct(
|
|
public string $rawName,
|
|
public string $title,
|
|
public ?string $author = null,
|
|
public ?string $isbn = null,
|
|
public ?int $year = null,
|
|
public ?string $format = null,
|
|
public bool $isJunk = false,
|
|
public bool $isMagazine = false,
|
|
) {}
|
|
|
|
public function hasAuthor(): bool
|
|
{
|
|
return $this->author !== null && $this->author !== '';
|
|
}
|
|
|
|
public function searchQuery(): string
|
|
{
|
|
return trim(($this->author ?? '').' '.$this->title);
|
|
}
|
|
}
|