forked from lino/radar-wp
Initial import.
This commit is contained in:
commit
86383280c9
428 changed files with 68738 additions and 0 deletions
49
vendor/guzzle/common/Guzzle/Common/AbstractHasDispatcher.php
vendored
Normal file
49
vendor/guzzle/common/Guzzle/Common/AbstractHasDispatcher.php
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace Guzzle\Common;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
/**
|
||||
* Class that holds an event dispatcher
|
||||
*/
|
||||
class AbstractHasDispatcher implements HasDispatcherInterface
|
||||
{
|
||||
/** @var EventDispatcherInterface */
|
||||
protected $eventDispatcher;
|
||||
|
||||
public static function getAllEvents()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function setEventDispatcher(EventDispatcherInterface $eventDispatcher)
|
||||
{
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEventDispatcher()
|
||||
{
|
||||
if (!$this->eventDispatcher) {
|
||||
$this->eventDispatcher = new EventDispatcher();
|
||||
}
|
||||
|
||||
return $this->eventDispatcher;
|
||||
}
|
||||
|
||||
public function dispatch($eventName, array $context = array())
|
||||
{
|
||||
return $this->getEventDispatcher()->dispatch($eventName, new Event($context));
|
||||
}
|
||||
|
||||
public function addSubscriber(EventSubscriberInterface $subscriber)
|
||||
{
|
||||
$this->getEventDispatcher()->addSubscriber($subscriber);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue