-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor user anime/manga reviews + update schema [ci skip]
- Loading branch information
Irfan
committed
Aug 1, 2020
1 parent
01d6357
commit 732dcbf
Showing
18 changed files
with
171 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<?php | ||
|
||
namespace Jikan\Model\User\Reviews; | ||
|
||
|
||
use Jikan\Model\Common\MangaMeta; | ||
use Jikan\Model\Manga\MangaReviewScores; | ||
use Jikan\Model\Reviews\MangaReview; | ||
use Jikan\Parser\Reviews\MangaReviewParser; | ||
|
||
/** | ||
* Class UserAnimeReview | ||
* | ||
* @package Jikan\Model | ||
*/ | ||
class UserMangaReview extends MangaReview | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
public function getChaptersRead(): string | ||
{ | ||
return $this->chaptersRead; | ||
} | ||
|
||
/** | ||
* @return MangaReviewScores | ||
*/ | ||
public function getScores(): MangaReviewScores | ||
{ | ||
return $this->scores; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getMalId(): int | ||
{ | ||
return $this->malId; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getUrl(): string | ||
{ | ||
return $this->url; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getType(): string | ||
{ | ||
return $this->type; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getVotes(): int | ||
{ | ||
return $this->votes; | ||
} | ||
|
||
/** | ||
* @return \DateTimeImmutable | ||
*/ | ||
public function getDate(): \DateTimeImmutable | ||
{ | ||
return $this->date; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getReview(): string | ||
{ | ||
return $this->review; | ||
} | ||
|
||
/** | ||
* @return MangaMeta | ||
*/ | ||
public function getManga(): MangaMeta | ||
{ | ||
return $this->manga; | ||
} | ||
|
||
/** | ||
* @var MangaMeta | ||
*/ | ||
private $manga; | ||
|
||
/** | ||
* @param MangaReviewParser $parser | ||
* @return UserAnimeReview | ||
* @throws \Exception | ||
*/ | ||
public static function fromParser(MangaReviewParser $parser): UserMangaReview | ||
{ | ||
$instance = new self(); | ||
|
||
$instance->manga = $parser->getManga(); | ||
$instance->malId = $parser->getId(); | ||
$instance->url = $parser->getUrl(); | ||
$instance->type = $parser->getType(); | ||
$instance->votes = $parser->getHelpfulCount(); | ||
$instance->date = $parser->getDate(); | ||
$instance->scores = $parser->getMangaScores(); | ||
$instance->review = $parser->getContent(); | ||
$instance->chaptersRead = $parser->getChaptersRead(); | ||
|
||
return $instance; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.