Phergie_Event_Command::setPlugin PHP Method

setPlugin() public method

Stores a reference to the plugin instance that created the event.
public setPlugin ( Phergie_Plugin_Abstract $plugin ) : Phergie_Event_Command
$plugin Phergie_Plugin_Abstract Plugin instance
return Phergie_Event_Command Provides a fluent interface
    public function setPlugin(Phergie_Plugin_Abstract $plugin)
    {
        $this->plugin = $plugin;
        return $this;
    }

Usage Example

Beispiel #1
0
 /**
  * Adds an event to the queue.
  *
  * @param Phergie_Plugin_Abstract $plugin Plugin originating the event
  * @param string                  $type   Event type, corresponding to a 
  *        Phergie_Event_Command::TYPE_* constant
  * @param array                   $args   Optional event arguments
  *
  * @return Phergie_Event_Handler Provides a fluent interface
  */
 public function addEvent(Phergie_Plugin_Abstract $plugin, $type, array $args = array())
 {
     if (!defined('Phergie_Event_Command::TYPE_' . strtoupper($type))) {
         throw new Phergie_Event_Exception('Unknown event type "' . $type . '"', Phergie_Event_Exception::ERR_UNKNOWN_EVENT_TYPE);
     }
     $event = new Phergie_Event_Command();
     $event->setPlugin($plugin)->setType($type)->setArguments($args);
     $this->events[] = $event;
     return $this;
 }
All Usage Examples Of Phergie_Event_Command::setPlugin
Phergie_Event_Command