Compare commits

..

No commits in common. "main" and "0.2.0" have entirely different histories.
main ... 0.2.0

4 changed files with 5 additions and 32 deletions

View file

@ -1,6 +1,6 @@
<?php
namespace Yggverse\Parser;
namespace YGGverse\Parser;
class Magnet {
@ -9,38 +9,13 @@ class Magnet {
return ('magnet' == parse_url($link, PHP_URL_SCHEME));
}
public static function isXTv1(string $xt) : bool
{
return ('urn' == parse_url($xt, PHP_URL_SCHEME) && false !== strpos($xt, ':btih:'));
}
public static function isXTv2(string $xt) : bool
{
return ('urn' == parse_url($xt, PHP_URL_SCHEME) && false !== strpos($xt, ':btmh:1220'));
}
public static function filterInfoHash(string $value) : string
{
return trim(
str_replace(
[
'urn:',
'btih:',
'btmh:1220',
],
false,
$value
)
);
}
public static function parse(string $link) : mixed
{
$result =
[
'xt' => null,
'dn' => null,
'xl' => 0,
'xt' => [],
'tr' => [],
'ws' => [],
'as' => [],
@ -62,7 +37,6 @@ class Magnet {
[
'magnet:',
'?',
'xt=',
'tr=',
'ws=',
'as=',
@ -73,7 +47,6 @@ class Magnet {
[
false,
false,
'xt[]=',
'tr[]=',
'ws[]=',
'as[]=',

View file

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

View file

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

View file

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