Skip to content

Commit

Permalink
Merge pull request #344 from N0D4N/fix-userupdates-status
Browse files Browse the repository at this point in the history
Fix userupdates status parsing
  • Loading branch information
irfan-dahir authored Apr 12, 2021
2 parents 48915ef + 4e5c11a commit 0ac1ac3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Parser/User/Profile/LastUpdatesParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class LastUpdatesParser
/**
* @var Crawler
*/
private $crawler;
private Crawler $crawler;

/**
* LastUpdates constructor.
Expand All @@ -41,7 +41,7 @@ public function getModel(): LastUpdates
public function getLastAnimeUpdates(): array
{
$arr = $this->parseBaseListUpdates('anime');
$results = array();
$results = [];
/**
* @var $baseLastUpdate BaseLastUpdate
*/
Expand All @@ -58,7 +58,7 @@ public function getLastAnimeUpdates(): array
public function getLastMangaUpdates(): array
{
$arr = $this->parseBaseListUpdates('manga');
$results = array();
$results = [];
/**
* @var $baseLastUpdate BaseLastUpdate
*/
Expand Down Expand Up @@ -88,7 +88,6 @@ private function parseBaseListUpdates(string $updateType): array
/** @var $progressed int|null */
$progressed = null;

$status = "";
$progressedTotalSeparatorIndex = strpos($progressTypeValueUnparsed, '/');
if ($progressedTotalSeparatorIndex != false) {
$totalUnparsed = substr($progressTypeValueUnparsed, $progressedTotalSeparatorIndex + 1);
Expand All @@ -97,9 +96,10 @@ private function parseBaseListUpdates(string $updateType): array
$progressed = ctype_digit($progressedUnparsed) ? intval($progressedUnparsed) : null;
$status = trim(substr($progressTypeValueUnparsed, 0, $progressedTotalSeparatorIndex - 2));
} else {
$progressTypeValueUnparsed = str_replace(" -", "", $progressTypeValueUnparsed);
$status = trim($progressTypeValueUnparsed);
}
return new BaseLastUpdate($url, $title, $imageUrl, $progressed, $total, $status, $score, $date);
});
}
}
}

0 comments on commit 0ac1ac3

Please sign in to comment.