PHP 5.4 EventEmitter trait ported from node.js