Varien_Event_Observer Class Reference

Inheritance diagram for Varien_Event_Observer:

Varien_Object Varien_Event_Observer_Cron Varien_Event_Observer_Regex

List of all members.

Public Member Functions

 isValidFor (Varien_Event $event)
 dispatch (Varien_Event $event)
 getName ()
 setName ($data)
 getEventName ()
 setEventName ($data)
 getCallback ()
 setCallback ($data)
 getEvent ()
 setEvent ($data)


Detailed Description

Definition at line 35 of file Observer.php.


Member Function Documentation

dispatch ( Varien_Event event  ) 

Dispatches an event to observer's callback

Parameters:
Varien_Event $event
Returns:
Varien_Event_Observer

Definition at line 54 of file Observer.php.

00055     {
00056         if (!$this->isValidFor($event)) {
00057             return $this;
00058         }
00059 
00060         $callback = $this->getCallback();
00061         $this->setEvent($event);
00062 
00063         $_profilerKey = 'OBSERVER: '.(is_object($callback[0]) ? get_class($callback[0]) : (string)$callback[0]).' -> '.$callback[1];
00064         Varien_Profiler::start($_profilerKey);
00065         call_user_func($callback, $this);
00066         Varien_Profiler::stop($_profilerKey);
00067 
00068         return $this;
00069     }

getCallback (  ) 

Definition at line 91 of file Observer.php.

00092     {
00093         return $this->getData('callback');
00094     }

getEvent (  ) 

Get observer event object

Returns:
Varien_Event

Definition at line 106 of file Observer.php.

00107     {
00108         return $this->getData('event');
00109     }

getEventName (  ) 

Definition at line 81 of file Observer.php.

00082     {
00083         return $this->getData('event_name');
00084     }

getName (  ) 

Definition at line 71 of file Observer.php.

00072     {
00073         return $this->getData('name');
00074     }

isValidFor ( Varien_Event event  ) 

Checkes the observer's event_regex against event's name

Parameters:
Varien_Event $event
Returns:
boolean

Reimplemented in Varien_Event_Observer_Cron, and Varien_Event_Observer_Regex.

Definition at line 43 of file Observer.php.

00044     {
00045         return $this->getEventName()===$event->getName();
00046     }

setCallback ( data  ) 

Definition at line 96 of file Observer.php.

00097     {
00098         return $this->setData('callback', $data);
00099     }

setEvent ( data  ) 

Definition at line 111 of file Observer.php.

00112     {
00113         return $this->setData('event', $data);
00114     }

setEventName ( data  ) 

Definition at line 86 of file Observer.php.

00087     {
00088         return $this->setData('event_name', $data);
00089     }

setName ( data  ) 

Definition at line 76 of file Observer.php.

00077     {
00078         return $this->setData('name', $data);
00079     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:25:01 2009 for Magento by  doxygen 1.5.8