Compare commits

..

5 commits
0.3.0 ... main

Author SHA1 Message Date
ghost
74de022cd5 fix namespace 2023-10-09 04:52:01 +03:00
ghost
26111fce28 remove neitanod/forceutf8 dependency 2023-09-20 15:18:16 +03:00
ghost
47c7d13697 add neitanod/forceutf8 dependency 2023-09-20 14:28:52 +03:00
ghost
81f019be7a fix 0x1220 multihash prefix for v2 btmh part 2023-09-05 19:15:29 +03:00
ghost
c32a3b5f7d add trim to filterInfoHash method 2023-09-04 01:38:55 +03:00
4 changed files with 15 additions and 13 deletions

View file

@ -1,6 +1,6 @@
<?php <?php
namespace YGGverse\Parser; namespace Yggverse\Parser;
class Magnet { class Magnet {
@ -16,19 +16,21 @@ class Magnet {
public static function isXTv2(string $xt) : bool public static function isXTv2(string $xt) : bool
{ {
return ('urn' == parse_url($xt, PHP_URL_SCHEME) && false !== strpos($xt, ':btmh:')); return ('urn' == parse_url($xt, PHP_URL_SCHEME) && false !== strpos($xt, ':btmh:1220'));
} }
public static function filterInfoHash(string $value) : string public static function filterInfoHash(string $value) : string
{ {
return str_replace( return trim(
[ str_replace(
'urn:', [
'btih:', 'urn:',
'btmh:', 'btih:',
], 'btmh:1220',
false, ],
$value false,
$value
)
); );
} }

View file

@ -1,6 +1,6 @@
<?php <?php
namespace YGGverse\Parser; namespace Yggverse\Parser;
class Url { class Url {

View file

@ -1,6 +1,6 @@
<?php <?php
namespace YGGverse\Parser; namespace Yggverse\Parser;
class Urn { class Urn {

View file

@ -1,6 +1,6 @@
<?php <?php
namespace YGGverse\Parser\Tests; namespace Yggverse\Parser\Tests;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;