Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'weierophinney/hotfix/bootstrap-em-injec…
Browse files Browse the repository at this point in the history
…tion'
  • Loading branch information
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/ProvidesEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ trait ProvidesEvents
*/
public function setEventManager(EventCollection $events)
{
$identifiers = array(__CLASS__, get_class($this));
if (isset($this->eventIdentifier)) {
if ((is_string($this->eventIdentifier))
|| (is_array($this->eventIdentifier))
|| ($this->eventIdentifier instanceof Traversable)
) {
$identifiers = array_unique(array_merge($identifiers, (array) $this->eventIdentifier));
} elseif (is_object($this->eventIdentifier)) {
$identifiers[] = $this->eventIdentifier;
}
// silently ignore invalid eventIdentifier types
}
$events->setIdentifiers($identifiers);
$this->events = $events;
return $this;
}
Expand All @@ -59,19 +72,7 @@ public function setEventManager(EventCollection $events)
public function events()
{
if (!$this->events instanceof EventCollection) {
$identifiers = array(__CLASS__, get_class($this));
if (isset($this->eventIdentifier)) {
if ((is_string($this->eventIdentifier))
|| (is_array($this->eventIdentifier))
|| ($this->eventIdentifier instanceof Traversable)
) {
$identifiers = array_unique(array_merge($identifiers, (array) $this->eventIdentifier));
} elseif (is_object($this->eventIdentifier)) {
$identifiers[] = $this->eventIdentifier;
}
// silently ignore invalid eventIdentifier types
}
$this->setEventManager(new EventManager($identifiers));
$this->setEventManager(new EventManager());
}
return $this->events;
}
Expand Down

0 comments on commit 73208bf

Please sign in to comment.