Hook Sorting Should Be Done Once
taufik-nurrohman opened this issue · comments
Taufik Nurrohman commented
Line 22 in f7ab403
Whenever a Hook::fire()
is invoked, a task to sort the added hooks by stack
property is performed. This task can be reduced by only doing the sorting once. But I need an indicator to tell the Hook
that it needs to do the sorting:
- Invoking
Hook::set()
should trigger the sorting again. - Invoking
Hook::get()
should not trigger the sorting. - Invoking
Hook::let()
should not trigger the sorting as it’s just an action to remove or halt a hook. - Invoking
Hook::fire()
for the first time should trigger the sorting. - Invoking
Hook::fire()
for the second time and the rest should not trigger the sorting, as it’s already done in the first invoke.
Taufik Nurrohman commented
Lines 181 to 186 in 8abbb07
If the array input contains only 1 item or empty, we can skip the sorting task entirely! 😄