1<?php
2/**
3 * Zend Framework (http://framework.zend.com/)
4 *
5 * @link      http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license   http://framework.zend.com/license/new-bsd New BSD License
8 */
9
10namespace Zend\Mvc\Service;
11
12use Zend\EventManager\EventManager;
13use Zend\ServiceManager\FactoryInterface;
14use Zend\ServiceManager\ServiceLocatorInterface;
15
16class EventManagerFactory implements FactoryInterface
17{
18    /**
19     * Create an EventManager instance
20     *
21     * Creates a new EventManager instance, seeding it with a shared instance
22     * of SharedEventManager.
23     *
24     * @param  ServiceLocatorInterface $serviceLocator
25     * @return EventManager
26     */
27    public function createService(ServiceLocatorInterface $serviceLocator)
28    {
29        $em = new EventManager();
30        $em->setSharedManager($serviceLocator->get('SharedEventManager'));
31        return $em;
32    }
33}
34