Skip to content

Commit

Permalink
Renaming a few methods, doc block improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Krämer committed Jun 2, 2016
1 parent 2004d5a commit e3d5f65
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/Event/EventManager.php
Expand Up @@ -54,18 +54,18 @@ class EventManager
protected $_isGlobal = false;

/**
* The event stack object.
* The event list object.
*
* @var \Cake\Event\EventList|null
*/
protected $_eventList;

/**
* Enables automatic adding of events to the event stack object if it is present.
* Enables automatic adding of events to the event list object if it is present.
*
* @param bool
*/
protected $_listEvents = false;
protected $_trackEvents = false;

/**
* Returns the globally available instance of a Cake\Event\EventManager
Expand Down Expand Up @@ -360,8 +360,8 @@ public function dispatch($event)

$listeners = $this->listeners($event->name());
if (empty($listeners)) {
if ($this->_listEvents) {
$this->listEvent($event);
if ($this->_trackEvents) {
$this->addEventToList($event);
}
return $event;
}
Expand All @@ -379,8 +379,8 @@ public function dispatch($event)
}
}

if ($this->_listEvents) {
$this->listEvent($event);
if ($this->_trackEvents) {
$this->addEventToList($event);
}
return $event;
}
Expand Down Expand Up @@ -492,50 +492,50 @@ public function getEventList()
}

/**
* Adds an event to the stack if the stack object is present.
* Adds an event to the list if the event list object is present.
*
* @param \Cake\Event\Event $event An event to add to the stack.
* @param \Cake\Event\Event $event An event to add to the list.
* @return void
*/
public function listEvent(Event $event)
public function addEventToList(Event $event)
{
if ($this->_eventList) {
$this->_eventList->add($event);
}
}

/**
* Enables / disables event stacking at runtime.
* Enables / disables event tracking at runtime.
*
* @param bool $enabled True or false to enable / disable it.
* @return void
*/
public function listEvents($enabled)
public function trackEvents($enabled)
{
$this->_listEvents = (bool)$enabled;
$this->_trackEvents = (bool)$enabled;
}

/**
* Enables the stacking of dispatched events.
* Enables the listing of dispatched events.
*
* @param \Cake\Event\EventList $eventList The event stack object to use.
* @param \Cake\Event\EventList $eventList The event list object to use.
* @return void
*/
public function setEventList(EventList $eventList)
{
$this->_eventList = $eventList;
$this->_listEvents = true;
$this->_trackEvents = true;
}

/**
* Disables the stacking of dispatched events.
* Disables the listing of dispatched events.
*
* @return void
*/
public function unsetEventList()
{
$this->_eventList = null;
$this->_listEvents = false;
$this->_trackEvents = false;
}

/**
Expand Down

0 comments on commit e3d5f65

Please sign in to comment.