Skip to content

Commit f2f4b5e

Browse files
committed
fix: rename unhybridized method to unhybridizedTo for clarity
1 parent e0b77de commit f2f4b5e

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ $fileTree = $torrent->getFileTree(?$sortType = TorrentFile::FILETREE_SORT_NORMAL
239239
*
240240
* @since v2.5.0
241241
*/
242-
$v1ProtocolOnlyTorrent = $hybridTorrent->unhybridized(TorrentFile::PROTOCOL_V1);
243-
$v2ProtocolOnlyTorrent = $hybridTorrent->unhybridized(TorrentFile::PROTOCOL_V2);
242+
$v1ProtocolOnlyTorrent = $hybridTorrent->unhybridizedTo(TorrentFile::PROTOCOL_V1);
243+
$v2ProtocolOnlyTorrent = $hybridTorrent->unhybridizedTo(TorrentFile::PROTOCOL_V2);
244244

245245
// 7. Other method
246246
$torrent->cleanCache();

src/TorrentFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ public function getFileTree($sortType = self::FILETREE_SORT_NORMAL)
811811
* @throws ParseException If the current torrent is not hybrid or an unknown `$targetVersion` is provided.
812812
* @since v2.5.0
813813
*/
814-
public function unhybridized($targetProtocol = self::PROTOCOL_V1)
814+
public function unhybridizedTo($targetProtocol = self::PROTOCOL_V1)
815815
{
816816
$currentProtocol = $this->getProtocol();
817817
if ($currentProtocol !== self::PROTOCOL_HYBRID && $currentProtocol !== $targetProtocol) {

tests/traits/TorrentFileCommonTrait.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,10 @@ public function testUnhybridizedTorrent()
352352
{
353353
if ($this->protocol == TorrentFile::PROTOCOL_HYBRID) {
354354
// After unhybridized to target 'v1' or 'v2', the returned torrent's protocol should be target protocol.
355-
$v1ProtocolOnlyTorrent = $this->torrent->unhybridized(TorrentFile::PROTOCOL_V1);
355+
$v1ProtocolOnlyTorrent = $this->torrent->unhybridizedTo(TorrentFile::PROTOCOL_V1);
356356
$this->assertEquals(TorrentFile::PROTOCOL_V1, $v1ProtocolOnlyTorrent->getProtocol());
357357

358-
$v2ProtocolOnlyTorrent = $this->torrent->unhybridized(TorrentFile::PROTOCOL_V2);
358+
$v2ProtocolOnlyTorrent = $this->torrent->unhybridizedTo(TorrentFile::PROTOCOL_V2);
359359
$this->assertEquals(TorrentFile::PROTOCOL_V2, $v2ProtocolOnlyTorrent->getProtocol());
360360

361361
// The origin torrent's protocol is not change.
@@ -371,15 +371,15 @@ public function testUnhybridizedTorrentToUnknownTarget()
371371
$this->expectException(ParseException::class);
372372
$this->expectExceptionMessage('Unknown unhybridized target.');
373373

374-
$this->torrent->unhybridized('unknown');
374+
$this->torrent->unhybridizedTo('unknown');
375375
} else {
376376
$this->markTestSkipped();
377377
}
378378
}
379379

380380
public function testUnhybridizedTorrentToSameProtocol()
381381
{
382-
$unhybridizedTorrentWithSameProtocol = $this->torrent->unhybridized($this->protocol);
382+
$unhybridizedTorrentWithSameProtocol = $this->torrent->unhybridizedTo($this->protocol);
383383
$this->assertEquals($this->protocol, $unhybridizedTorrentWithSameProtocol->getProtocol());
384384
}
385385

@@ -389,7 +389,7 @@ public function testNonHybridTorrentCantConversion()
389389
// Conversion between v1-only and v2-only torrents is not allowed
390390
$this->expectException(ParseException::class);
391391
$this->expectExceptionMessage('Unable to unhybridized, this torrent is ');
392-
$this->torrent->unhybridized($this->protocol == TorrentFile::PROTOCOL_V1 ? TorrentFile::PROTOCOL_V2 : TorrentFile::PROTOCOL_V1);
392+
$this->torrent->unhybridizedTo($this->protocol == TorrentFile::PROTOCOL_V1 ? TorrentFile::PROTOCOL_V2 : TorrentFile::PROTOCOL_V1);
393393
} else {
394394
$this->markTestSkipped();
395395
}
@@ -401,7 +401,7 @@ public function testNonHybridTorrentCantUpgradeToHybrid()
401401
// v1-only and v2-only torrents can't upgrade to hybrid torrent
402402
$this->expectException(ParseException::class);
403403
$this->expectExceptionMessage('Unable to unhybridized, this torrent is ');
404-
$this->torrent->unhybridized(TorrentFile::PROTOCOL_HYBRID);
404+
$this->torrent->unhybridizedTo(TorrentFile::PROTOCOL_HYBRID);
405405
} else {
406406
$this->markTestSkipped();
407407
}

0 commit comments

Comments
 (0)