src/WithEvents.php
public function subscribe($eventType, $callback)
    {
        $callback = $this->makeEventCallback($callback);
        if (!isset($this->eventList[$eventType]) || !is_array($this->eventList[$eventType])) {
            $this->eventList[$eventType] = [];
        }
        array_push($this->eventList[$eventType], $callback);
        return $callback['id'];
    }
public function subscribe($eventType, $callback)
    {
        $callback = $this->makeEventCallback($callback);
        if (!isset($this->eventList[$eventType]) || !is_array($this->eventList[$eventType])) {
            $this->eventList[$eventType] = [];
        }
        array_push($this->eventList[$eventType], $callback);
        return $callback['id'];
    }
public function subscribe ( $ eventType , $ callback ) { $ callback = $ this -> makeEventCallback ( $ callback ) ; if ( ! isset ( $ this -> eventList [ $ eventType ] ) || ! is_array ( $ this -> eventList [ $ eventType ] ) ) { $ this -> eventList [ $ eventType ] = [ ] ; } array_push ( $ this -> eventList [ $ eventType ] , $ callback ) ; return $ callback [ 'id' ] ; }
Add a callback on a specific backend event.
@param string $eventType - Use constants(add your own if needed)
@param callable $callback - Execution callback.
@return string|null
Add a callback on a specific backend event .