public function attach($eventName, $callback, $priority = 1): void
    {
        if (!isset($this->listeners[$eventName])) {
            $this->listeners[$eventName] = [];
        }
        if (!isset($this->listeners[$eventName][$priority])) {
            $this->listeners[$eventName][$priority] = [];
        }
        $this->listeners[$eventName][$priority][] = $callback;
    }
public function attach($eventName, $callback, $priority = 1): void
    {
        if (!isset($this->listeners[$eventName])) {
            $this->listeners[$eventName] = [];
        }
        if (!isset($this->listeners[$eventName][$priority])) {
            $this->listeners[$eventName][$priority] = [];
        }
        $this->listeners[$eventName][$priority][] = $callback;
    }
public function attach ( $ eventName , $ callback , $ priority = 1 ) : void { if ( ! isset ( $ this -> listeners [ $ eventName ] ) ) { $ this -> listeners [ $ eventName ] = [ ] ; } if ( ! isset ( $ this -> listeners [ $ eventName ] [ $ priority ] ) ) { $ this -> listeners [ $ eventName ] [ $ priority ] = [ ] ; } $ this -> listeners [ $ eventName ] [ $ priority ] [ ] = $ callback ; }
Attach callback to event

@param  string   $eventName
@param  callable $callback
@param  integer  $priority

@return void
Attach callback to event