for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @package EBloodBank
* @since 1.6
*/
namespace EBloodBank;
use Psr\Container\ContainerInterface;
class EventManagerFactory
{
* @param ContainerInterface $container
* @return EventManager
public function __invoke(ContainerInterface $container)
$eventManager = new EventManager();
$this->addEventListener($eventManager, $container);
return $eventManager;
}
* @param EventManager $eventManager
* @return void
protected function addEventListener(EventManager $eventManager, ContainerInterface $container)
$emailNotificationListener = Listeners\EmailNotificationListener::factory($container);
$eventManager->getEventDispatcher()->addListener('user.created', $emailNotificationListener);
$eventManager->getEventDispatcher()->addListener('donor.created', $emailNotificationListener);