Skip to content

Commit

Permalink
performance optimizations
Browse files Browse the repository at this point in the history
SmetDenis committed Mar 6, 2016
1 parent 49437a0 commit a793cf2
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/EventManager.php
Original file line number Diff line number Diff line change
@@ -115,13 +115,11 @@ public function once($eventName, $callBack, $priority = 100)
*/
public function trigger($eventName, array $arguments = array(), $continueCallback = null)
{
$eventName = $this->cleanEventName($eventName);

if (strpos($eventName, '*') !== false) {
throw new Exception('Event name "' . $eventName . '" shouldn\'t contain symbol "*"');
}

$listeners = $this->getList($eventName, false);
$listeners = $this->getList($eventName);

if (null === $continueCallback) {
$execCount = $this->_callListeners($listeners, $arguments);
@@ -207,15 +205,12 @@ protected function _callListener($listener, array $arguments)
* their priority.
*
* @param string $eventName
* @param bool $cleanup
* @return callable[]
* @throws Exception
*/
public function getList($eventName, $cleanup = true)
public function getList($eventName)
{
if ($cleanup) {
$eventName = $this->cleanEventName($eventName);
}
$eventName = $this->cleanEventName($eventName);

if ($eventName === '*') {
throw new Exception('Unsafe event name!');

0 comments on commit a793cf2

Please sign in to comment.