mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-03-31 17:15:38 +00:00
add torrent file validation
This commit is contained in:
parent
5aa20e6a22
commit
f919a7ed85
2 changed files with 14 additions and 6 deletions
|
|
@ -32,14 +32,22 @@ class TorrentService
|
|||
// Tools
|
||||
public function readTorrentFileByFilepath(
|
||||
string $filepath
|
||||
): \Rhilip\Bencode\TorrentFile
|
||||
): ?\Rhilip\Bencode\TorrentFile
|
||||
{
|
||||
return \Rhilip\Bencode\TorrentFile::load(
|
||||
$filepath
|
||||
);
|
||||
try
|
||||
{
|
||||
return \Rhilip\Bencode\TorrentFile::load(
|
||||
$filepath
|
||||
);
|
||||
}
|
||||
|
||||
catch (\Rhilip\Bencode\ParseException $error)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function readTorrentFileById(
|
||||
public function readTorrentFileByTorrentId(
|
||||
int $id
|
||||
): \Rhilip\Bencode\TorrentFile
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue