This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
forked from phpforce/soap-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added composer dependency and class from Phpforce common package
- Loading branch information
Rajan
authored and
Rajan
committed
Dec 20, 2016
1 parent
c3a5f90
commit f4952e1
Showing
2 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
namespace Phpforce\Common; | ||
use Symfony\Component\EventDispatcher\EventDispatcherInterface; | ||
use Symfony\Component\EventDispatcher\EventDispatcher; | ||
use Symfony\Component\EventDispatcher\Event; | ||
/** | ||
* Can be extended by classes that dispatch events using the event dispatcher | ||
* | ||
*/ | ||
abstract class AbstractHasDispatcher | ||
{ | ||
/** | ||
* @var EventDispatcherInterface | ||
*/ | ||
protected $eventDispatcher; | ||
/** | ||
* Set event dispatcher | ||
* | ||
* @param EventDispatcherInterface $eventDispatcher | ||
*/ | ||
public function setEventDispatcher(EventDispatcherInterface $eventDispatcher) | ||
{ | ||
$this->eventDispatcher = $eventDispatcher; | ||
} | ||
/** | ||
* Get event dispatcher | ||
* | ||
* If no event dispatcher is supplied, a new one is created. This one will | ||
* then be used internally by the Accelerate library. | ||
* | ||
* @return EventDispatcherInterface | ||
*/ | ||
public function getEventDispatcher() | ||
{ | ||
if (null == $this->eventDispatcher) { | ||
$this->eventDispatcher = new EventDispatcher(); | ||
} | ||
return $this->eventDispatcher; | ||
} | ||
/** | ||
* Dispatch an event | ||
* | ||
* @param string $name Name of event: see Events.php | ||
* @param Event $event Event object | ||
* | ||
* @return Event | ||
*/ | ||
protected function dispatch($name, Event $event) | ||
{ | ||
return $this->getEventDispatcher()->dispatch($name, $event); | ||
} | ||
} |