1
0
mirror of https://github.com/Chouchen/ShikiryuRSS.git synced 2025-09-05 13:04:32 +02:00

🚧 Continues tests, parser and starts builder

For #4
This commit is contained in:
2023-04-07 17:57:35 +02:00
parent fec8c122e3
commit 63d0b03b50
18 changed files with 494 additions and 234 deletions

View File

@@ -2,9 +2,11 @@
namespace Shikiryu\SRSS;
use DateTimeInterface;
class SRSSTools
{
public static function check($check, $flag)
/*public static function check($check, $flag)
{
return match ($flag) {
'nohtml' => self::noHTML($check),
@@ -19,11 +21,9 @@ class SRSSTools
'media_type' => self::checkMediaType($check),
'media_medium' => self::checkMediaMedium($check),
'bool' => self::checkBool($check),
'medium_expression' => self::checkMediumExpression($check),
'' => $check,
default => throw new SRSSException('flag ' . $flag . ' does not exist.'),
'medium_expression' => self::checkMediumExpression($check)
};
}
}*/
/**
* format the RSS to the wanted format
@@ -61,6 +61,10 @@ class SRSSTools
return date("D, d M Y H:i:s T", strtotime($date));
}
if (count(explode(' ', $date)) === 2) {
return \DateTime::createFromFormat('Y-m-d H:i:s', $date)->format(DateTimeInterface::RSS);
}
[$j, $m, $a] = explode('/', $date);
return date("D, d M Y H:i:s T", strtotime($a.'-'.$m.'-'.$j));