On Tue, Aug 25, 2009 at 8:33 AM, Ilmari Karonennospam@vyznev.net wrote:
Tim Starling wrote:
Aryeh Gregor wrote:
and img might be:
public static function img( $src, $alt, $attribs = array() ) {
I'm afraid your thinking on this is going in precisely the opposite direction to mine. I think long lists of formal parameters make code almost impossible to read and nearly as difficult to write. It might take slightly longer to type
Html::img( array( 'src' => $src, 'alt' => $alt ) );
...although at that point you might almost as well just go the extra step and make it:
Html::element( 'img', array( 'src' => $src, 'alt' => $alt ) );
-- Ilmari Karonen
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
I'm a fan of using the arrays for the majority of params, how Tim describes. Classes, IDs, default values, all of this stuff should be in an associative array.
The only exception I can think of is for the absurdly obvious ones: Html::a( $href, array() ) or Html::img( $src, array() ); To me, putting the tags in that form would be the most intuitive.
-Chad