Added league/event and implemented SessionOwnerEvent

This commit is contained in:
Alex Bilbie
2014-07-11 15:13:28 +01:00
parent 33c68a2103
commit 954f29f879
6 changed files with 91 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ namespace League\OAuth2\Server;
use League\OAuth2\Server\Exception;
use League\OAuth2\Server\TokenType\TokenTypeInterface;
use Symfony\Component\HttpFoundation\Request;
use League\Event\Emitter;
/**
* OAuth 2.0 Resource Server
@@ -40,6 +41,37 @@ abstract class AbstractServer
*/
protected $tokenType;
/**
* Event emitter
*/
protected $eventEmitter;
/**
* Abstract server constructor
*/
public function __construct()
{
$this->eventEmitter = $this->setEventEmitter();
}
/**
* Set an event emitter
* @param object $emitter Event emitter object
*/
public function setEventEmitter($emitter = null)
{
if ($emitter === null) {
$this->eventEmitter = new Emitter;
} else {
$this->eventEmitter = $emitter;
}
}
public function addEventListener($eventName, callable $listener)
{
$this->eventEmitter->addListener($eventName, $listener);
}
/**
* Sets the Request Object
* @param \Symfony\Component\HttpFoundation\Request The Request Object