r62079 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62078‎ | r62079 | r62080 >
Date:08:48, 7 February 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
More documentation
Modified paths:
  • /trunk/extensions/Translate/utils/Html.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/utils/Html.php
@@ -7,6 +7,7 @@
88 * replaces the current value and the object itself is returned. This allows
99 * chaining calls. Noted as chain-accessor in the comments. Example:
1010 * <code>$tag = new HtmlTag( 'div' ); $div = $div->content( 'foo' )->style( 'color', 'red' );</code>
 11+ * Note: relies on implicit toString conversion (PHP >= 5.2)
1112 */
1213 class HtmlTag {
1314 public $tag = 'div';
@@ -121,6 +122,7 @@
122123 /**
123124 * Returns the html output. Use this when you don't want to use
124125 * implicit string conversion.
 126+ * @return string html
125127 */
126128 public function html() {
127129 // Collapse styles
@@ -135,10 +137,18 @@
136138 }
137139 }
138140
 141+ /**
 142+ * Wrapper for html method, for implicit conversion to string.
 143+ * @return string html
 144+ */
139145 public function __toString() {
140146 return $this->html();
141147 }
142148
 149+ /**
 150+ * Constructs the value for style parameter.
 151+ * @return string The value for style parameter.
 152+ */
143153 public function collapseStyles() {
144154 $style = '';
145155
@@ -180,8 +190,12 @@
181191
182192 }
183193
184 -
 194+/**
 195+ * Class for passing data to HtmlTag. Useful when you already
 196+ * have piece of html.
 197+ */
185198 class RawHtml {
 199+ /** Contents */
186200 public $data = '';
187201
188202 public function __construct( $data ) {
@@ -193,6 +207,10 @@
194208 }
195209 }
196210
 211+/**
 212+ * Wrapper class which implements array properties. Useful for adding multiple
 213+ * tags inside as contents of another tag. Items must be pre-escaped!
 214+ */
197215 class TagContainer implements ArrayAccess {
198216 public $tags = array();
199217

Status & tagging log