remove php 8 syntax
This commit is contained in:
parent
719ec53089
commit
22b22ddab3
|
@ -2,12 +2,12 @@
|
|||
declare(strict_types = 1);
|
||||
|
||||
class ComicPage {
|
||||
public int $serial = 0;
|
||||
public string $href = '';
|
||||
public string $pageNo = '';
|
||||
public string $title = '';
|
||||
public string $imageUrl = '';
|
||||
public int $pubDate = 0;
|
||||
public $serial = 0;
|
||||
public $href = '';
|
||||
public $pageNo = '';
|
||||
public $title = '';
|
||||
public $imageUrl = '';
|
||||
public $pubDate = 0;
|
||||
|
||||
function __construct() {}
|
||||
function __toString() {
|
||||
|
|
|
@ -6,7 +6,7 @@ include_once('config/default.php');
|
|||
use GuzzleHttp\Client as HTTPClient;
|
||||
use PHPHtmlParser\Dom as DOM;
|
||||
|
||||
function fetchUrl(string $url) {
|
||||
function fetchUrl($url) {
|
||||
$client = new HTTPClient();
|
||||
|
||||
$res = $client->request(
|
||||
|
|
|
@ -3,6 +3,10 @@ declare(strict_types = 1);
|
|||
|
||||
include_once('config/default.php');
|
||||
|
||||
function sortSerial($a, $b) {
|
||||
return $a->serial < $b->serial ? 1 : -1;
|
||||
}
|
||||
|
||||
function generateFeed($unsortedContent) {
|
||||
$loader = new \Twig\Loader\FilesystemLoader('templates/');
|
||||
$twig = new \Twig\Environment($loader, [
|
||||
|
@ -16,8 +20,7 @@ function generateFeed($unsortedContent) {
|
|||
$items = [];
|
||||
|
||||
$content = $unsortedContent;
|
||||
// Sort by date descending (newest first)
|
||||
usort($content, fn($a, $b) => $a->serial < $b->serial ? 1 : -1);
|
||||
usort($content, "sortSerial");
|
||||
|
||||
foreach ($content as $page) {
|
||||
$content = $twig->render('item-content.html', [
|
||||
|
|
Loading…
Reference in New Issue