original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Attach callback to event
  
  @param  string   $eventName
  @param  callable $callback
  @param  integer  $priority
  
  @return void
docstring_tokens: Attach callback to event