$userData)); * $event = new CakeEvent('User.afterRegister', $UserModel); * ``` */ public function __construct($name, $subject = null, $data = null) { $this->_name = $name; $this->data = $data; $this->_subject = $subject; } /** * Dynamically returns the name and subject if accessed directly * * @param string $attribute Attribute name. * @return mixed */ public function __get($attribute) { if ($attribute === 'name' || $attribute === 'subject') { return $this->{$attribute}(); } } /** * Returns the name of this event. This is usually used as the event identifier * * @return string */ public function name() { return $this->_name; } /** * Returns the subject of this event * * @return string */ public function subject() { return $this->_subject; } /** * Stops the event from being used anymore * * @return void */ public function stopPropagation() { return $this->_stopped = true; } /** * Check if the event is stopped * * @return bool True if the event is stopped */ public function isStopped() { return $this->_stopped; } }