From 2761d32cce488b713b362a4d28762c1bf159dc84 Mon Sep 17 00:00:00 2001 From: Travis Date: Sat, 18 Jul 2020 21:52:17 +0300 Subject: [PATCH] Fixed #1 Now aired() method return all data that contains in raw JSON --- metadata/JikanPHP.Model.Common.DateProp.yml | 6 +-- metadata/JikanPHP.Model.Common.DateRange.yml | 8 ++- model/Common/DateRange.php | 53 ++++++++++++++++++-- 3 files changed, 60 insertions(+), 7 deletions(-) diff --git a/metadata/JikanPHP.Model.Common.DateProp.yml b/metadata/JikanPHP.Model.Common.DateProp.yml index c3fc4a8..ab03a03 100644 --- a/metadata/JikanPHP.Model.Common.DateProp.yml +++ b/metadata/JikanPHP.Model.Common.DateProp.yml @@ -1,8 +1,8 @@ JikanPHP\Model\Common\DateProp: properties: day: - type: '' + type: integer month: - type: '' + type: integer year: - type: '' + type: integer \ No newline at end of file diff --git a/metadata/JikanPHP.Model.Common.DateRange.yml b/metadata/JikanPHP.Model.Common.DateRange.yml index 05cca33..6715a8d 100644 --- a/metadata/JikanPHP.Model.Common.DateRange.yml +++ b/metadata/JikanPHP.Model.Common.DateRange.yml @@ -1,4 +1,10 @@ JikanPHP\Model\Common\DateRange: properties: - date: + string: type: string + from: + type: string + to: + type: string + prop: + type: array \ No newline at end of file diff --git a/model/Common/DateRange.php b/model/Common/DateRange.php index 2f5d38c..d2934d2 100644 --- a/model/Common/DateRange.php +++ b/model/Common/DateRange.php @@ -12,13 +12,60 @@ class DateRange /** * @var string */ - private $date; + private $string; + + /** + * @var string + */ + private $from; + + /** + * @var string + */ + private $to; + + /** + * @var DateProp[] + */ + private $prop; /** * @return string */ public function getDate(): string { - return $this->date; + return $this->string; + } + + /** + * @return string + */ + public function getFrom(): string + { + return $this->from; + } + + /** + * @return string + */ + public function getUntil(): string + { + return $this->to; + } + + /** + * @return DateProp + */ + public function getFromProp(): DateProp + { + return reset($this->prop); + } + + /** + * @return DateProp + */ + public function getUntilProp(): DateProp + { + return end($this->prop); } -} +} \ No newline at end of file