diff --git a/CHANGELOG.md b/CHANGELOG.md index 744f1aa5..5c3f4fb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,7 +43,7 @@ All notable changes to this project will be documented in this file. - Changed default CLIENT_PULL_STRATEGY_INTERVAL value to 10 minutes. - Changed code analysis tool from psalm to phpstan. - Changed src/Controller/Api/AuthOidcController.php to get session from request. -- Nofified FeedType: Added support for video media. +- Nofified FeedType: Added support for video media and cleanup implementation. ### NB! Prior to 3.x the project was split into separate repositories diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index c769103b..96fb5c50 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1824,18 +1824,6 @@ parameters: count: 1 path: src/Feed/NotifiedFeedType.php - - - message: '#^Method App\\Feed\\NotifiedFeedType\:\:getFeedItemObject\(\) has parameter \$item with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Feed/NotifiedFeedType.php - - - - message: '#^Method App\\Feed\\NotifiedFeedType\:\:getFeedItemObject\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Feed/NotifiedFeedType.php - - message: '#^Method App\\Feed\\NotifiedFeedType\:\:getMentions\(\) has parameter \$searchProfileIds with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue diff --git a/src/Feed/NotifiedFeedType.php b/src/Feed/NotifiedFeedType.php index b8a69027..91f88137 100644 --- a/src/Feed/NotifiedFeedType.php +++ b/src/Feed/NotifiedFeedType.php @@ -24,7 +24,6 @@ class NotifiedFeedType implements FeedTypeInterface { final public const string SUPPORTED_FEED_TYPE = FeedOutputModels::INSTAGRAM_OUTPUT; - private const int REQUEST_TIMEOUT = 10; private const string BASE_URL = 'https://api.listen.notified.com'; private const string DATETIME_FORMAT = 'Y-m-d\TH:i:s.v\Z'; private const string LOOKBACK_PERIOD = '-3 months'; @@ -55,11 +54,10 @@ public function getData(Feed $feed): array $token = $secrets['token']; - $feedItems = []; + $mentions = []; try { - $data = $this->getMentions($token, 1, $pageSize, $configuration['feeds']); - $feedItems = array_map($this->getFeedItemObject(...), $data); + $mentions = $this->getMentions($token, 1, $pageSize, $configuration['feeds']); } catch (\Throwable $throwable) { $this->logger->error("NotifiedFeedType: Failed to get mentions: {$throwable->getMessage()}"); } @@ -69,7 +67,7 @@ public function getData(Feed $feed): array // Check that image/video is available and accessible, otherwise leave out the feed element. // Use the content type to determine if the mediaUrl is an image or video. // If the content type is not available, try to determine it from the file extension. - foreach ($feedItems as $dataItem) { + foreach ($mentions as $dataItem) { $mediaUrl = $dataItem['mediaUrl'] ?? null; if (!is_string($mediaUrl)) {