3 namespace Caxy\HtmlDiff\ListDiff;
7 protected $attributes = array();
15 public function __construct($text, $attributes = array(), $startTag, $endTag)
18 $this->attributes = $attributes;
19 $this->startTag = $startTag;
20 $this->endTag = $endTag;
26 public function getAttributes()
28 return $this->attributes;
32 * @param array $attributes
34 * @return DiffListItem
36 public function setAttributes($attributes)
38 $this->attributes = $attributes;
46 public function getText()
54 * @return DiffListItem
56 public function setText($text)
66 public function getStartTag()
68 return $this->startTag;
71 public function getStartTagWithDiffClass($class = 'normal')
73 return str_replace('>', ' class="'.$class.'">', $this->startTag);
77 * @param mixed $startTag
79 * @return DiffListItem
81 public function setStartTag($startTag)
83 $this->startTag = $startTag;
91 public function getEndTag()
97 * @param mixed $endTag
99 * @return DiffListItem
101 public function setEndTag($endTag)
103 $this->endTag = $endTag;
108 public function getHtml($class = 'normal', $wrapTag = null)
110 $startWrap = $wrapTag ? sprintf('<%s>', $wrapTag) : '';
111 $endWrap = $wrapTag ? sprintf('</%s>', $wrapTag) : '';
113 return sprintf('%s%s%s%s%s', $this->getStartTagWithDiffClass($class), $startWrap, $this->getInnerHtml(), $endWrap, $this->endTag);
116 public function getInnerHtml()
118 return implode('', $this->text);
121 public function __toString()
123 return $this->getHtml();