public function add_listener( $event_name, $listener, $priority = self::PRIORITY, $accepted_args = self::ACCEPTED ) {

		if ( ! is_callable( $listener, true ) ) {
			throw new InvalidListenerException( '$listener must be callable.' );
		}

		if ( ! is_int( $priority ) ) {
			throw new \InvalidArgumentException( '$priority must be an int.' );
		}

		if ( ! is_int( $accepted_args ) ) {
			throw new \InvalidArgumentException( '$accepted must be an int.' );
		}

		add_filter( $this->get_action_name_for_event( $event_name ), $listener, $priority, $accepted_args );

		return $this;
	}
public function add_listener( $event_name, $listener, $priority = self::PRIORITY, $accepted_args = self::ACCEPTED ) {

		if ( ! is_callable( $listener, true ) ) {
			throw new InvalidListenerException( '$listener must be callable.' );
		}

		if ( ! is_int( $priority ) ) {
			throw new \InvalidArgumentException( '$priority must be an int.' );
		}

		if ( ! is_int( $accepted_args ) ) {
			throw new \InvalidArgumentException( '$accepted must be an int.' );
		}

		add_filter( $this->get_action_name_for_event( $event_name ), $listener, $priority, $accepted_args );

		return $this;
	}
public function add_listener ( $ event_name , $ listener , $ priority = self :: PRIORITY , $ accepted_args = self :: ACCEPTED ) { if ( ! is_callable ( $ listener , true ) ) { throw new InvalidListenerException ( '$listener must be callable.' ) ; } if ( ! is_int ( $ priority ) ) { throw new \ InvalidArgumentException ( '$priority must be an int.' ) ; } if ( ! is_int ( $ accepted_args ) ) { throw new \ InvalidArgumentException ( '$accepted must be an int.' ) ; } add_filter ( $ this -> get_action_name_for_event ( $ event_name ) , $ listener , $ priority , $ accepted_args ) ; return $ this ; }
Add an event listener that listens for a given event.

@since 1.0

@param string   $event_name    The fully-qualified event name to listen for.
@param callable $listener      Listener to be called whenever the event occurs.
@param int      $priority      The priority of the listener. Lower priority listeners are called earlier.
@param int      $accepted_args Number of arguments the listener accepts. Defaults to 3.

@return self
Add an event listener that listens for a given event .