src/Builder/Builder.php
public function registerEventHandler($event, callable $handler)
    {
        if (empty($event)) {
            throw new InvalidArgumentException('Event name is required');
        }

        if (is_callable($handler)) {
            if (empty($this->event_handlers[$event])) {
                $this->event_handlers[$event] = [];
            }

            $this->event_handlers[$event][] = $handler;
        } else {
            throw new InvalidArgumentException('Handler not callable');
        }
    }
public function registerEventHandler($event, callable $handler)
    {
        if (empty($event)) {
            throw new InvalidArgumentException('Event name is required');
        }

        if (is_callable($handler)) {
            if (empty($this->event_handlers[$event])) {
                $this->event_handlers[$event] = [];
            }

            $this->event_handlers[$event][] = $handler;
        } else {
            throw new InvalidArgumentException('Handler not callable');
        }
    }
public function registerEventHandler ( $ event , callable $ handler ) { if ( empty ( $ event ) ) { throw new InvalidArgumentException ( 'Event name is required' ) ; } if ( is_callable ( $ handler ) ) { if ( empty ( $ this -> event_handlers [ $ event ] ) ) { $ this -> event_handlers [ $ event ] = [ ] ; } $ this -> event_handlers [ $ event ] [ ] = $ handler ; } else { throw new InvalidArgumentException ( 'Handler not callable' ) ; } }
Register an internal event handler.

@param string   $event
@param callable $handler
Register an internal event handler .