IntegrationModuleEvent::setModule()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/**
3
 * @link    https://github.com/nnx-framework/module
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace Nnx\Module\Event;
7
8
use Zend\EventManager\Event;
9
use Zend\ModuleManager\ModuleManagerInterface;
10
11
/**
12
 * Class IntegrationModuleEvent
13
 *
14
 * @package Nnx\Module\Event
15
 */
16
class IntegrationModuleEvent extends Event implements IntegrationModuleEventInterface
17
{
18
    /**
19
     * Менеджер модулей
20
     *
21
     * @var ModuleManagerInterface
22
     */
23
    protected $moduleManager;
24
25
    /**
26
     * Объект модуля для котрого происходит инциацилзация
27
     *
28
     * @var mixed
29
     */
30
    protected $module;
31
32
    /**
33
     * @inheritdoc
34
     *
35
     * @return ModuleManagerInterface
36
     *
37
     * @throws Exception\InvalidModuleManagerException
38
     */
39
    public function getModuleManager()
40
    {
41
        if (!$this->moduleManager instanceof ModuleManagerInterface) {
42
            $errMsg = 'Module manager not installed';
43
            throw new Exception\InvalidModuleManagerException($errMsg);
44
        }
45
        return $this->moduleManager;
46
    }
47
48
    /**
49
     * @inheritdoc
50
     *
51
     * @param ModuleManagerInterface $moduleManager
52
     *
53
     * @return $this
54
     */
55
    public function setModuleManager(ModuleManagerInterface $moduleManager)
56
    {
57
        $this->moduleManager = $moduleManager;
58
59
        return $this;
60
    }
61
62
    /**
63
     * @inheritdoc
64
     *
65
     * @return mixed
66
     */
67
    public function getModule()
68
    {
69
        return $this->module;
70
    }
71
72
    /**
73
     * Устанавливает объект модуля для котрого происходит инциацилзация
74
     *
75
     * @param mixed $module
76
     *
77
     * @return $this
78
     */
79
    public function setModule($module)
80
    {
81
        $this->module = $module;
82
83
        return $this;
84
    }
85
}
86