/
Speed up kEvent class [5.3.0-B1]

Speed up kEvent class [5.3.0-B1]

The event methodology is the code of In-Portal and there are hundreds of kEvent class objects constructed during regular page run. Initially the kEvent class accepted 2 arguments:

  • $params - an array containing prefixspecial and name keys
  • $specific_params - additional parameters that are set within event

Over time more compact format was developed for value of $params argument, a string in following format: prefix.special:name. To be backwards compatible a decision was made to support both formats by placing IF statement in kEvent class constructor. In retrospective this was a bad idea, because:

  • all but 3 places are using new format now
  • the constructor has to check for old format on every call even if it almost never matches

Solution

  1. make kEvent class constructor accept only new format
  2. create static kEvent::fromArray method, that would support old invocation way if needed
  3. replace 3 places, that use old format with fromArray method call (or let them use new format)

Related Tasks

INP-1462 - Getting issue details... STATUS