-
-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #543 from jikan-me/feature/industry-news
Industry News
- Loading branch information
Showing
96 changed files
with
2,864 additions
and
1,330 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ composer.phar | |
.phpunit.result.cache | ||
.phpdoc | ||
.phive | ||
.phpunit.cache |
Large diffs are not rendered by default.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
<?php | ||
|
||
namespace Jikan\Model\Common; | ||
|
||
use Jikan\Model\Resource\NewsImageResource\NewsImageResource; | ||
use Jikan\Parser\Common\NewsMetaParser; | ||
|
||
/** | ||
* Class NewsMeta | ||
* | ||
* @package Jikan\Model | ||
*/ | ||
class NewsMeta | ||
{ | ||
/** | ||
* @var int | ||
*/ | ||
private int $malId; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private string $url; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private string $title; | ||
|
||
/** | ||
* @var \DateTimeImmutable | ||
*/ | ||
private \DateTimeImmutable $date; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private string $authorUsername; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private string $authorUrl; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private string $forumUrl; | ||
|
||
/** | ||
* @var NewsImageResource | ||
*/ | ||
private NewsImageResource $images; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
private int $comments; | ||
|
||
/** | ||
* @param NewsMetaParser $parser | ||
* @return self | ||
*/ | ||
public static function fromParser(NewsMetaParser $parser): self | ||
{ | ||
$instance = new self(); | ||
|
||
$instance->malId = $parser->getMalId(); | ||
$instance->url = $parser->getUrl(); | ||
$instance->title = $parser->getTitle(); | ||
$instance->comments = $parser->getComments(); | ||
$instance->authorUsername = $parser->getAuthor()->getName(); | ||
$instance->authorUrl = $parser->getAuthor()->getUrl(); | ||
$instance->forumUrl = $parser->getDiscussionLink(); | ||
$instance->images = NewsImageResource::factory($parser->getImageUrl()); | ||
$instance->date = $parser->getDate(); | ||
|
||
return $instance; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function __toString() | ||
{ | ||
return $this->title; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getMalId(): int | ||
{ | ||
return $this->malId; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getUrl(): string | ||
{ | ||
return $this->url; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getTitle(): string | ||
{ | ||
return $this->title; | ||
} | ||
|
||
/** | ||
* @return \DateTimeImmutable | ||
*/ | ||
public function getDate(): \DateTimeImmutable | ||
{ | ||
return $this->date; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getAuthorUsername(): string | ||
{ | ||
return $this->authorUsername; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getAuthorUrl(): string | ||
{ | ||
return $this->authorUrl; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getForumUrl(): string | ||
{ | ||
return $this->forumUrl; | ||
} | ||
|
||
/** | ||
* @return NewsImageResource | ||
*/ | ||
public function getImages(): NewsImageResource | ||
{ | ||
return $this->images; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getComments(): int | ||
{ | ||
return $this->comments; | ||
} | ||
} |
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,92 @@ | ||
<?php | ||
|
||
namespace Jikan\Model\Common; | ||
|
||
use Jikan\Helper\Parser; | ||
use Jikan\Parser\Common\TagUrlParser; | ||
|
||
/** | ||
* Class ItemMeta | ||
* | ||
* @package Jikan\Model | ||
*/ | ||
class TagMeta | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private string $name; | ||
/** | ||
* @var string | ||
*/ | ||
private string $malId; | ||
/** | ||
* @var string | ||
*/ | ||
private string $url; | ||
/** | ||
* @var string | ||
*/ | ||
private string $type; | ||
/** | ||
* @var string|null | ||
*/ | ||
private ?string $description; | ||
|
||
|
||
/** | ||
* @param string $name | ||
* @param string $url | ||
* @param string $type | ||
* @param string|null $description | ||
*/ | ||
public function __construct(string $name, string $url, string $type, ?string $description) | ||
{ | ||
$this->url = $url; | ||
$this->name = $name; | ||
$this->type = $type; | ||
$this->description = $description; | ||
$this->malId = Parser::stringIdFromUrl($this->url); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getName(): string | ||
{ | ||
return $this->name; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getMalId(): string | ||
{ | ||
return $this->malId; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getUrl(): string | ||
{ | ||
return $this->url; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getType(): string | ||
{ | ||
return $this->type; | ||
} | ||
|
||
/** | ||
* @return string|null | ||
*/ | ||
public function getDescription(): ?string | ||
{ | ||
return $this->description; | ||
} | ||
|
||
} |
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,71 @@ | ||
<?php | ||
|
||
namespace Jikan\Model\Common; | ||
|
||
/** | ||
* Class Url | ||
* | ||
* @package Jikan\Model | ||
*/ | ||
class TagUrl | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private string $malId; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private string $name; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private string $url; | ||
|
||
/** | ||
* Genre constructor. | ||
* | ||
* @param string $name | ||
* @param string $url | ||
*/ | ||
public function __construct(string $malId, string $name, string $url) | ||
{ | ||
$this->malId = $malId; | ||
$this->name = $name; | ||
$this->url = $url; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function __toString(): string | ||
{ | ||
return $this->name; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getMalId(): string | ||
{ | ||
return $this->malId; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getName(): string | ||
{ | ||
return $this->name; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getUrl(): string | ||
{ | ||
return $this->url; | ||
} | ||
} |
Oops, something went wrong.