Renders the feed and returns a string representation.

@param FeedInterface $feed

@return string
344503
public function render(FeedInterface $feed)
    {
        $parameters = array(
            'feed' => $feed,
            'dateFormat' => \DateTime::RFC822,
        );

        return $this->templating->render('ArgentumFeedBundle::rss.xml.twig', $parameters);
    }
372380
public function render(ElementInterface $element): string
    {
        $field = $this->factory->create($element->type())
            ->render($element);

        $errors = $element instanceof ErrorAwareInterface
            ? $this->factory->create(Errors::class)
                ->render($element)
            : '';

        $description = $element instanceof DescriptionAwareInterface
            ? $this->factory->create(Description::class)
                ->render($element)
            : '';

        $label = $element instanceof LabelAwareInterface
            ? $this->factory->create(Label::class)
                ->render($element)
            : '';

        $html = ($label !== '')
            ? sprintf(
                '<th>%1$s</th><td>%2$s %3$s %4$s</td>',
                $label,
                $field,
                $description,
                $errors
            )
            : sprintf(
                '<td colspan="2">%1$s %2$s %3$s</td>',
                $field,
                $description,
                $errors
            );

        $rowAttributes = [
            'class' => 'form-row'.($errors === ''
                    ? ''
                    : ' form-row--has-errors'),
        ];

        return '<tr '.$this->attributesToString($rowAttributes).'>'.$html.'</tr>';
    }
246391
public function getFeeds()
	{
		// Build the request path.
		$path = '/feeds';

		return $this->processResponse(
			$this->client->get($this->fetchUrl($path))
		);
	}
537037
public function getPsrResponse(FeedInterface $feed, string $standard, int $maxAge = 600, bool $public = true) : ResponseInterface
    {
        $this->logAction($feed, "creating a PSR 7 Response in $standard format");

        $formatter = $this->getStandard($standard)->getFormatter();
        $responseBuilder = new ResponseBuilder($maxAge, $public);

        return $responseBuilder->createResponse($standard, $formatter, $feed);
    }
772887
public function renderFeedBlockAction($feedUrl, $offset = 0, $limit = 5)
    {
        $response = new Response();
        try {
            // Keep response in cache. TTL is configured in default_settings.yml
            $response->setSharedMaxAge($this->container->getParameter('ezdemo.cache.feed_reader_ttl'));

            return $this->render(
                'eZDemoBundle:frontpage:feed_block.html.twig',
                array(
                    'feed' => ezcFeed::parse($feedUrl),
                    'offset' => $offset,
                    'limit' => $limit,
                ),
                $response
            );
        }
        // In the case of exception raised in ezcFeed, return the empty response to fail nicely.
        catch (Exception $e) {
            $this->get('logger')->error("An exception has been raised when fetching RSS feed: {$e->getMessage()}");

            return $response;
        }
    }
61536
final private function getTrafficData($feedUrl)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $feedUrl);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $response = curl_exec($ch);
        curl_close($ch);

        $xml = simplexml_load_string($response);

        return $this->sanitizeTrafficData($this->parseTrafficData($xml));
    }
1157337
public function display()
    {

        //add feed properties
        $this->channelPropertiesToDOM();

        //add items
        foreach($this->items as $item){

            $this->appendItem($item);
        }

        return $this->saveXML();
    }
292917
protected function maybeRender($content)
    {
        if ($content instanceof ViewModel) {
            $content = $this->getView()->render($content);
        }

        return (string) $content;
    }
650682
public function feed()
    {
        $page = TypiCMS::getPageLinkedToModule('news');
        if (!$page) {
            return;
        }
        $feed = app('feed');
        if (config('typicms.cache')) {
            $feed->setCache(60, 'typicmsNewsFeed');
        }
        if (!$feed->isCached()) {
            $models = $this->repository->latest(10);

            $feed->title = $page->title.' – '.TypiCMS::title();
            $feed->description = $page->body;
            if (config('typicms.image')) {
                $feed->logo = url('storage/settings/'.config('typicms.image'));
            }
            $feed->link = url()->route(config('app.locale').'::news-feed');
            $feed->setDateFormat('datetime'); // 'datetime', 'timestamp' or 'carbon'
            if (isset($models[0]) && $models[0]->date) {
                $feed->pubdate = $models[0]->date;
            }
            $feed->lang = config('app.locale');
            $feed->setShortening(true); // true or false
            $feed->setTextLimit(100); // maximum length of description text

            foreach ($models as $model) {
                $feed->add($model->title, null, url($model->uri()), $model->date, $model->summary, $model->present()->body);
            }
        }

        return $feed->render('atom');
    }
568508
public static function getResponseLine(ResponseInterface $response): string
    {
        return sprintf(
            '%s %d%s',
            self::getProtocol($response),
            self::getStatus($response),
            ($response->getReasonPhrase() ? ' '.$response->getReasonPhrase() : '')
        );
    }
1118896
public function getFeedContent(array $options) : FeedInterface
    {
        $feed = new Feed();

        $id = array_key_exists('id', $options) ? $options['id'] : null;

        if ($id === 'not-found') {
            throw new FeedNotFoundException();
        }

        $feed->setPublicId($id);

        $feed->setTitle('thank you for using RssAtomBundle');
        $feed->setDescription('this is the mock FeedContent');
        $feed->setLink('https://raw.github.com/alexdebril/rss-atom-bundle/');
        $feed->setLastModified(new \DateTime());

        return $this->addItem($feed);
    }
686339
protected function uriToFeedComponent(): Uri
    {
        $uri = new Uri(static::BASE_URL.$this->account->getPid().'/'.$this->feedConfig->getPid());

        if ($this->feedTypeSubFeed) {
            $uri = $uri->withPath($uri->getPath().'/'.$this->feedTypeSubFeed->getFeedType());
        }

        if ($this->isReturnsFeed()) {
            $uri = $uri->withPath($uri->getPath().'/feed');
        }

        return $uri;
    }
1223813
public function getFeed($name)
    {
        if (!isset($this->feeds[$name])) {
            throw new \InvalidArgumentException(sprintf('Feed "%s" is not registered', $name));
        }

        return $this->feeds[$name];
    }
1105701
protected function outputRss($feed)
    {
        // Send XML/no cache headers
        header('Content-Type: application/xml; charset=utf-8');
        header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');

        echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
        echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">' . "\n";
        echo "\t" . '<channel>' . "\n";
        echo "\t\t" . '<atom:link href="' .
            Utils::escape(Url::current()) . '" rel="self" type="application/rss+xml" />' . "\n";
        echo "\t\t" . '<title><![CDATA[' . $this->escapeCdata($feed['title']) . ']]></title>' . "\n";
        echo "\t\t" . '<link>' . Utils::escape($feed['link']) . '</link>' . "\n";
        echo "\t\t" . '<description><![CDATA[' .
            $this->escapeCdata($feed['description']) . ']]></description>' . "\n";
        echo "\t\t" . '<lastBuildDate>' . gmdate('r', count($feed['items']) ? $feed['items'][0]['pubdate'] :
                time()) . '</lastBuildDate>' . "\n";

        if (ForumSettings::get('o_show_version') == '1') {
            echo "\t\t" . '<generator>RunBB ' . ForumSettings::get('o_cur_version') . '</generator>' . "\n";
        } else {
            echo "\t\t" . '<generator>RunBB</generator>' . "\n";
        }

        foreach ($feed['items'] as $item) {
            echo "\t\t" . '<item>' . "\n";
            echo "\t\t\t" . '<title><![CDATA[' . $this->escapeCdata($item['title']) . ']]></title>' . "\n";
            echo "\t\t\t" . '<link>' . Utils::escape($item['link']) . '</link>' . "\n";
            echo "\t\t\t" . '<description><![CDATA[' .
                $this->escapeCdata($item['description']) . ']]></description>' . "\n";
            echo "\t\t\t" . '<author><![CDATA[' . (isset($item['author']['email']) ?
                    $this->escapeCdata($item['author']['email']) : 'dummy@example.com') . ' (' .
                $this->escapeCdata($item['author']['name']) . ')]]></author>' . "\n";
            echo "\t\t\t" . '<pubDate>' . gmdate('r', $item['pubdate']) . '</pubDate>' . "\n";
            echo "\t\t\t" . '<guid>' . Utils::escape($item['link']) . '</guid>' . "\n";

            echo "\t\t" . '</item>' . "\n";
        }

        echo "\t" . '</channel>' . "\n";
        echo '</rss>' . "\n";
    }
201537
protected function _renderTag($attribs = array(), $content = null, TemplateInterface $template)
    {
        unset($attribs['content']);
        unset($attribs['separator']);

        $attribs = $this->buildAttributes($attribs);

        if($this->getConfig()->escape) {
            $content = StringEscaper::html($content);
        }

        $html = '<title '.$attribs.'>'.$content.'</title>'."\n";
        return $html;
    }
562423
public function show($type)
    {
        $feedData = $this->feed->where('slug', $type)->firstOrFail();
        $model = $feedData->model;
        $entries = $model::getFeedItems();

        $feed = new Feed;

        $channel = new Channel;
        $channel
            ->title($feedData->title)
            ->description($feedData->description)
            ->url($feedData->url)
            ->language($feedData->language)
            ->copyright($feedData->copyright)
            ->ttl($feedData->ttl)
            ->appendTo($feed);

        foreach($entries as $entry)
        {
            $item = new Item;
            $item
                ->title($entry->itemTitle())
                ->description($entry->itemDescription())
                ->contentEncoded($entry->itemContent())
                ->url($entry->itemUrl())
                ->guid($entry->itemUrl(), true)
                ->pubDate($entry->itemPubDate())
                ->appendTo($channel);
        }

        return $feed;
    }
461803
public function toString(ResponseInterface $response)
    {
        $string = sprintf(
            "HTTP/%s %s %s\n",
            $response->getProtocolVersion(),
            $response->getStatusCode(),
            $response->getReasonPhrase()
        );

        $string .= $this->headersAndBody($response);

        return $string;
    }