src/Events/Event.php
public function attachHandler(callable $handler, $key = null)
    {
        if ($key !== null) {
            $this->eventHandlers[$key] = $handler;
        } else {
            $this->eventHandlers[] = $handler;
        }
    }
public function attachHandler(callable $handler, $key = null)
    {
        if ($key !== null) {
            $this->eventHandlers[$key] = $handler;
        } else {
            $this->eventHandlers[] = $handler;
        }
    }
public function attachHandler ( callable $ handler , $ key = null ) { if ( $ key !== null ) { $ this -> eventHandlers [ $ key ] = $ handler ; } else { $ this -> eventHandlers [ ] = $ handler ; } }
Attach an event handler

@param callable $handler
@param string $key An optional unique identifier for the handler in case you wish to specifically remove it later
Attach an event handler