public function transform(FeedItem $item) { $array = ['title' => $item->getTitle(), 'link' => $item->getUrl(), 'author' => $item->getAuthor(), 'publishedDate' => $item->getDate()->format('D, d M Y H:i:s O'), 'contentSnippet' => preg_replace('/\\s+?(\\S+)?$/', '', substr(strip_tags($item->getContent()), 0, 150)), 'content' => $item->getContent()]; if (($media = $item->getMedia()) && ($thumbnails = $media->getThumbnails()) && sizeof($thumbnails) > 0) { $array['thumbnail'] = $thumbnails[0]['url']; } return $array; }