<?php 
 
use Ite\EventManager\EventListenerManagerInterface; 
use Ite\EventManager\EventListenerManagerTrait; 
use Ite\EventManager\EventManager; 
use Psr\EventManager\EventInterface; 
 
chdir(realpath(__DIR__ . '/..')); 
 
require_once './vendor/autoload.php'; 
 
// load psr interfaces if they not exists 
// (not part of this package, but included for convenience): 
if (!interface_exists('Psr\\EventManager\\EventInterface')) { 
    require_once './psr/event-manager/EventInterface.php'; 
} 
if (!interface_exists('Psr\\EventManager\\EventManagerInterface')) { 
    require_once './psr/event-manager/EventManagerInterface.php'; 
} 
 
class EventManagerAwareTests implements EventListenerManagerInterface { 
 
    use EventListenerManagerTrait; 
 
    protected $checks = 'asd'; 
 
} 
 
$manager = new EventManagerAwareTests(); 
$manager->setEventManager(new EventManager()); 
 
$manager->addEventListener('TestEvent', function (EventInterface $e) { 
    var_dump($e, $this->checks); // wil dump the event object and 'asd' 
}, 0, true); 
 
$manager->fire('TestEvent', $manager); 
 
 |