Skip to content

Commit

Permalink
MDL-21198 improved parameter types specification in renderer api
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Dec 28, 2009
1 parent f1fdacd commit a309d7d
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lib/outputrenderers.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function has_started() {
* @param string $contents What goes between the opening and closing tags
* @return string HTML fragment
*/
protected function output_tag($tagname, $attributes, $contents) {
protected function output_tag($tagname, array $attributes = null, $contents) {
return $this->output_start_tag($tagname, $attributes) . $contents .
$this->output_end_tag($tagname);
}
Expand All @@ -82,7 +82,7 @@ protected function output_tag($tagname, $attributes, $contents) {
* @param array $attributes The tag attributes (array('src' => $url, 'class' => 'class1') etc.)
* @return string HTML fragment
*/
protected function output_start_tag($tagname, $attributes) {
protected function output_start_tag($tagname, array $attributes = null) {
return '<' . $tagname . $this->output_attributes($attributes) . '>';
}

Expand All @@ -101,7 +101,7 @@ protected function output_end_tag($tagname) {
* @param array $attributes The tag attributes (array('src' => $url, 'class' => 'class1') etc.)
* @return string HTML fragment
*/
protected function output_empty_tag($tagname, $attributes) {
protected function output_empty_tag($tagname, array $attributes = null) {
return '<' . $tagname . $this->output_attributes($attributes) . ' />';
}

Expand Down Expand Up @@ -130,10 +130,8 @@ protected function output_attribute($name, $value) {
* The values will be escaped with {@link s()}
* @return string HTML fragment
*/
protected function output_attributes($attributes) {
if (empty($attributes)) {
$attributes = array();
}
protected function output_attributes(array $attributes = null) {
$attributes = (array)$attributes;
$output = '';
foreach ($attributes as $name => $value) {
$output .= $this->output_attribute($name, $value);
Expand Down Expand Up @@ -190,7 +188,7 @@ protected function prepare_event_handlers(&$component) {
* @param html_component $component
* @return string CSS rules
*/
protected function prepare_legacy_width_and_height($component) {
protected function prepare_legacy_width_and_height(html_component $component) {
$output = '';
if (!empty($component->height)) {
// We need a more intelligent way to handle these warnings. If $component->height have come from
Expand Down

0 comments on commit a309d7d

Please sign in to comment.