aboutsummaryrefslogtreecommitdiff
path: root/src/Repositories/ChannelRepository.php
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2020-07-18 14:49:06 +0300
committerValentin Popov <info@valentineus.link>2020-07-18 14:49:06 +0300
commita52e2e198708cf3e24eda73cbbc5906593cc730a (patch)
treecadbfa28d9729d99f3dcc1153bbe4e14b3998b63 /src/Repositories/ChannelRepository.php
parent92bfdcb284477b66d0b3770bc8fbaf1c12cc0b56 (diff)
downloadphp-epg-service-a52e2e198708cf3e24eda73cbbc5906593cc730a.tar.xz
php-epg-service-a52e2e198708cf3e24eda73cbbc5906593cc730a.zip
Added DateTime of channel entity
Signed-off-by: Valentin Popov <info@valentineus.link>
Diffstat (limited to 'src/Repositories/ChannelRepository.php')
-rw-r--r--src/Repositories/ChannelRepository.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Repositories/ChannelRepository.php b/src/Repositories/ChannelRepository.php
index 44eac36..772e4f9 100644
--- a/src/Repositories/ChannelRepository.php
+++ b/src/Repositories/ChannelRepository.php
@@ -19,6 +19,7 @@ declare(strict_types = 1);
namespace EPGService\Repositories;
+use DateTime;
use EPGService\Entities\ChannelEntity;
use EPGService\Environments\ServiceEnvironment;
use EPGService\Parsers\StringParser;
@@ -66,6 +67,7 @@ final class ChannelRepository implements BaseRepository {
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \RuntimeException
+ * @throws \Exception
*/
public function get(): array {
$response = $this->client->get(self::METHOD);
@@ -84,6 +86,8 @@ final class ChannelRepository implements BaseRepository {
continue;
}
+ $update = StringParser::get($element->update);
+
$result[] = ChannelEntity::create([
'base_id' => StringParser::get($element->{'base-channel'}),
'base_name' => StringParser::get($element->{'base-channel'}['id']),
@@ -94,7 +98,7 @@ final class ChannelRepository implements BaseRepository {
'id' => StringParser::get($element['id']),
'lang' => StringParser::get($element->{'display-name'}['lang']),
'name' => StringParser::get($element->{'base-channel'}),
- 'update_at' => StringParser::get($element->update),
+ 'update_at' => new DateTime($update),
'week' => StringParser::get($element->week),
]);
}