TEXT; const PARAMETERS = [ [ 'feed_name' => [ 'name' => 'Feed name', 'type' => 'text', 'exampleValue' => 'FeedProxy', ], 'feed_1' => [ 'name' => 'Feed url', 'type' => 'text', 'required' => true, 'exampleValue' => 'https://lorem-rss.herokuapp.com/feed?unit=day' ], 'limit' => self::LIMIT, ] ]; /** * TODO: Consider a strategy which produces a shorter feed url */ public function collectData() { $limit = (int)($this->getInput('limit') ?: 99); $feed = $this->getInput('feed_1'); $this->collectExpandableDatas($feed, $limit); // Sort by timestamp, uri, title in descending order usort($this->items, function ($a, $b) { $t1 = $a['timestamp'] ?? $a['uri'] ?? $a['title']; $t2 = $b['timestamp'] ?? $b['uri'] ?? $b['title']; return $t2 <=> $t1; }); } public function getName() { return $this->getInput('feed_name') ?: 'FeedProxy'; } }