Skip to content

Commit

Permalink
Optimize helper event listeners.
Browse files Browse the repository at this point in the history
Most of the core helpers don't use event listeners. Stubbing out the
methods saves 6 calls to method_exists() per helper.
  • Loading branch information
markstory committed Mar 5, 2014
1 parent 01704a4 commit 8cbdfac
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/View/Helper/FormHelper.php
Expand Up @@ -2171,4 +2171,13 @@ public function widget($name, array $data = []) {
return $this->_registry->get($name)->render($data);
}

/**
* Event listeners.
*
* @return array
*/
public function implementedEvents() {
return [];
}

}
9 changes: 9 additions & 0 deletions src/View/Helper/HtmlHelper.php
Expand Up @@ -1237,4 +1237,13 @@ public function loadConfig($configFile, $path = null) {
return $configs;
}

/**
* Event listeners.
*
* @return array
*/
public function implementedEvents() {
return [];
}

}
9 changes: 9 additions & 0 deletions src/View/Helper/NumberHelper.php
Expand Up @@ -218,4 +218,13 @@ public function defaultCurrency($currency) {
return $this->_engine->defaultCurrency($currency);
}

/**
* Event listeners.
*
* @return array
*/
public function implementedEvents() {
return [];
}

}
9 changes: 9 additions & 0 deletions src/View/Helper/PaginatorHelper.php
Expand Up @@ -808,4 +808,13 @@ public function last($last = 'last >>', $options = array()) {
return $out;
}

/**
* Event listeners.
*
* @return array
*/
public function implementedEvents() {
return ['View.beforeRender' => 'beforeRender'];
}

}
9 changes: 9 additions & 0 deletions src/View/Helper/RssHelper.php
Expand Up @@ -351,4 +351,13 @@ public function elem($name, $attrib = array(), $content = null, $endTag = true)
return $xml;
}

/**
* Event listeners.
*
* @return array
*/
public function implementedEvents() {
return [];
}

}
9 changes: 9 additions & 0 deletions src/View/Helper/SessionHelper.php
Expand Up @@ -158,4 +158,13 @@ public function valid() {
return Session::valid();
}

/**
* Event listeners.
*
* @return array
*/
public function implementedEvents() {
return [];
}

}
9 changes: 9 additions & 0 deletions src/View/Helper/TextHelper.php
Expand Up @@ -325,4 +325,13 @@ public function toList($list, $and = 'and', $separator = ', ') {
return $this->_engine->toList($list, $and, $separator);
}

/**
* Event listeners.
*
* @return array
*/
public function implementedEvents() {
return [];
}

}
9 changes: 9 additions & 0 deletions src/View/Helper/TimeHelper.php
Expand Up @@ -446,4 +446,13 @@ public function i18nFormat($date, $format = null, $invalid = false, $timezone =
return $this->_engine->i18nFormat($date, $format, $invalid, $timezone);
}

/**
* Event listeners.
*
* @return array
*/
public function implementedEvents() {
return [];
}

}

0 comments on commit 8cbdfac

Please sign in to comment.