CRM-19813 - GenericHookEvent - Bridge between Symfony Events and hooks
The GenericHookEvent is used to expose all traditional hooks to the Symfony
EventDispatcher.
The traditional notation for a hook is based on a function signature:
function hook_civicrm_foo($bar, &$whiz, &$bang);
Symfony Events are based on a class with properties and methods. This
requires some kind of mapping.
Symfony Events has two conventions which might be used to support that
mapping. One might implement event classes for every hook, or one might use
the `GenericEvent`. This design-decision comes with a basic trade-off
between size (total #files, #classes, #SLOC) and IDE assistance
(docs/autocomplete):
* `GenericEvent` has smaller size and less boiler-plate, but it also
provides little IDE assistance.
* Custom event classes provide more IDE assistance, but they also
inflate the size (with lots of boilerplate).
This patch implements `GenericHookEvent`, which is conceptually similar to
`GenericEvent`, but it has a few modifications:
* The `__get()` function returns references, which makes it easier to
alter data.
* The `getHookValues()` function returns an ordered list of hook arguments.
The approach of `GenericEvent` / `GenericHookEvent` seems like a reasonable
balance -- it starts out with little boilerplate, but we can incrementally
introduce subclasses. The subclasses can:
* Use docblocks for IDE support
* Use declared properties for IDE support (though you may need to customize
the constructor, etal).
* Add semantic/businessy functions.
* Override the `__get()` / `__set()` functions to be provide
different getter/setter behavior.