mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Profiles and optimised EventManager::listeners() function, reducing execution time by 14.5%
Refs #2105
This commit is contained in:
parent
3561929be7
commit
e8984a9033
1 changed files with 12 additions and 1 deletions
|
@ -267,7 +267,18 @@ class CakeEventManager {
|
|||
if (empty($this->_listeners[$eventKey])) {
|
||||
return array();
|
||||
}
|
||||
ksort($this->_listeners[$eventKey]);
|
||||
|
||||
$listeners = $this->_listeners[$eventKey];
|
||||
foreach ($globalListeners as $priority => $priorityQ) {
|
||||
if (!empty($listeners[$priority])) {
|
||||
$listeners[$priority] = array_merge($listeners[$priority], $priorityQ);
|
||||
unset($globalListeners[$priority]);
|
||||
}
|
||||
|
||||
$listeners = $listeners + $globalListeners;
|
||||
}
|
||||
|
||||
ksort($listeners);
|
||||
$result = array();
|
||||
foreach ($this->_listeners[$eventKey] as $priorityQ) {
|
||||
$result = array_merge($result, $priorityQ);
|
||||
|
|
Loading…
Add table
Reference in a new issue