-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathModule.php
More file actions
58 lines (52 loc) · 1.6 KB
/
Module.php
File metadata and controls
58 lines (52 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
* This file is part of phpab/phpab-module. (https://github.com/phpab/phpab-module)
*
* @link https://github.com/phpab/phpab-module for the canonical source repository
* @copyright Copyright (c) 2015-2016 phpab. (https://github.com/phpab/)
* @license https://raw.githubusercontent.com/phpab/phpab-module/master/LICENSE MIT
*/
namespace PhpAbModule;
use PhpAb\Engine\EngineInterface;
use Zend\ModuleManager\Listener\ServiceListener;
use Zend\ModuleManager\ModuleEvent;
use Zend\ModuleManager\ModuleManagerInterface;
use Zend\ServiceManager\ServiceManager;
/**
* The Module class which is used to be loaded into a Zend Framework 2 application.
*/
class Module
{
/**
* Gets the configuration for this module.
*
* @return array
*/
public function getConfig()
{
return include __DIR__ . '/../config/module.config.php';
}
/**
* Initializes the module.
*
* @param ModuleManagerInterface $moduleManager
*/
public function init(ModuleManagerInterface $moduleManager)
{
$eventManager = $moduleManager->getEventManager();
$eventManager->attach(ModuleEvent::EVENT_LOAD_MODULES_POST, array($this, 'onLoadModulesPost'));
}
/**
* Called when the modules are loaded.
*
* @param ModuleEvent $event
*/
public function onLoadModulesPost(ModuleEvent $event)
{
/** @var ServiceManager $serviceManager */
$serviceManager = $event->getParam('ServiceManager');
/** @var EngineInterface $engine */
$engine = $serviceManager->get('phpab.engine');
$engine->start();
}
}