1<?php 2 3/** 4 * An HtmlDescribable is an item within a feed that can have a description that may 5 * include HTML markup. 6 * 7 * @package de.bitfolge.feedcreator 8 */ 9class HtmlDescribable 10{ 11 /** 12 * Indicates whether the description field should be rendered in HTML. 13 */ 14 public $descriptionHtmlSyndicated; 15 16 /** 17 * Indicates whether and to how many characters a description should be truncated. 18 */ 19 public $descriptionTruncSize; 20 21 /** @var string the Description */ 22 public $description; 23 24 /** 25 * Returns a formatted description field, depending on descriptionHtmlSyndicated and 26 * $descriptionTruncSize properties 27 * 28 * @param bool $overrideSyndicateHtml 29 * @return string the formatted description 30 */ 31 public function getDescription($overrideSyndicateHtml = false) 32 { 33 $descriptionField = new FeedHtmlField($this->description); 34 $descriptionField->syndicateHtml = $overrideSyndicateHtml || $this->descriptionHtmlSyndicated; 35 $descriptionField->truncSize = $this->descriptionTruncSize; 36 37 return $descriptionField->output(); 38 } 39} 40