GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

EntryIdResolver::getEntryToObjectsService()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * @link    https://github.com/old-town/workflow-zf2-toolkit
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace OldTown\Workflow\ZF2\Toolkit\WorkflowRunParams;
7
8
use Zend\EventManager\AbstractListenerAggregate;
9
use Zend\EventManager\EventManagerInterface;
10
use OldTown\Workflow\ZF2\Dispatch\RunParamsHandler\RouteHandler;
11
use OldTown\Workflow\ZF2\Dispatch\RunParamsHandler\RouteHandler\ResolveEntryIdEventInterface;
12
use OldTown\Workflow\ZF2\Toolkit\EntryToObjects\EntryToObjectsService;
13
use OldTown\Workflow\ZF2\Toolkit\Options\ModuleOptions;
14
use Zend\Mvc\MvcEvent;
15
use Zend\Log\LoggerInterface;
16
use Zend\Http\Request;
17
18
/**
19
 * Class EntryIdResolver
20
 *
21
 * @package OldTown\Workflow\ZF2\Toolkit\WorkflowRunParams
22
 */
23
class EntryIdResolver extends AbstractListenerAggregate
24
{
25
    /**
26
     * Имя параметра в конфиги модуля, по которому можно получить имя менеджера wf
27
     *
28
     * @var string
29
     */
30
    const WORKFLOW_MANAGER_NAME = 'workflowManagerName';
31
32
    /**
33
     * Имя параметра в конфиги модуля, по которому можно получить имя псевдонима менеджера wf
34
     *
35
     * @var string
36
     */
37
    const WORKFLOW_MANAGER_ALIAS = 'workflowManagerAlias';
38
39
    /**
40
     * Имя параметра в конфиге модуля, по которому можно получить имя wf
41
     *
42
     * @var string
43
     */
44
    const WORKFLOW_NAME = 'workflowName';
45
46
    /**
47
     * Имя параметра в конфиге модуля, по которому можно получить значение имени роутера
48
     *
49
     * @var string
50
     */
51
    const ROUTER_NAME = 'routeName';
52
53
    /**
54
     * Имя параметра в конфиге модуля, по которому можно конфиг описывающий какие классы и какие имена параметров
55
     * роуетера используется, для получения entryId
56
     *
57
     * @var string
58
     */
59
    const MAP = 'map';
60
61
    /**
62
     * Имя параметра в карте(@see const MAP), по которому можно получить класс сущности
63
     *
64
     * @var string
65
     */
66
    const ENTITY_CLASS_NAME = 'entityClassName';
67
68
    /**
69
     * Имя параметра в карте(@see const MAP), по которому можно получить конфиг описывающий как для заданного свойства
70
     * сущности(свойство является либо первичным ключем, либо составной частью первичного ключа) получиить из
71
     * урл значение.
72
     *
73
     *
74
     * @var string
75
     */
76
    const IDENTIFIERS_MAP = 'identifiersMap';
77
78
    /**
79
     * Имя параметра в карте(@see const IDENTIFIERS_MAP), по которому можно получить имя свойства сущности, которое
80
     * является первичным ключем (или частью первичного ключа)
81
     *
82
     *
83
     * @var string
84
     */
85
    const PROPERTY_NAME = 'propertyName';
86
87
    /**
88
     * Имя параметра в карте(@see const IDENTIFIERS_MAP), по которому можно определить как получить значение свойства,
89
     * из параметра роутера, или из query
90
     *
91
     * @var string
92
     */
93
    const MODE = 'mode';
94
95
    /**
96
     * Значение для параметра mode (@see const MODE), определяет что значение берется из параметров роутера
97
     *
98
     * @var string
99
     */
100
    const MODE_ROUTER_PARAM = 'param';
101
102
    /**
103
     * Значение для параметра mode (@see const MODE), определяет что значение берется из query части url
104
     *
105
     * @var string
106
     */
107
    const MODE_QUERY = 'query';
108
109
    /**
110
     * Имя параметра в карте(@see const IDENTIFIERS_MAP), определяет имя параметра роутера или query параметра
111
     * содержащие значение для propertyName (@see const PROPERTY_NAME)
112
     *
113
     * @var string
114
     */
115
    const PARAM_NAME = 'paramName';
116
117
    /**
118
     * Набор допустимых значений для mode (@see const MODE)
119
     *
120
     * @var array
121
     */
122
    protected $accessMode = [
123
        self::MODE_ROUTER_PARAM => self::MODE_ROUTER_PARAM,
124
        self::MODE_ROUTER_PARAM => self::MODE_ROUTER_PARAM,
125
    ];
126
127
    /**
128
     * Сервис реализующий функционал, для привязки процессов wf и информации о объектаъ
129
     *
130
     * @var EntryToObjectsService
131
     */
132
    protected $entryToObjectsService;
133
134
    /**
135
     * Настройки модуля
136
     *
137
     * @var ModuleOptions
138
     */
139
    protected $moduleOptions;
140
141
    /**
142
     * Индекс для маппинга
143
     *
144
     * @var null|array
145
     */
146
    protected $indexMetadata;
147
148
    /**
149
     * @var MvcEvent
150
     */
151
    protected $mvcEvent;
152
153
    /**
154
     * Логер
155
     *
156
     * @var LoggerInterface
157
     */
158
    protected $log;
159
160
    /**
161
     * EntryIdResolver constructor.
162
     *
163
     * @param array $options
164
     */
165
    public function __construct(array $options = [])
166
    {
167
        $initOptions = [
168
            array_key_exists('entryToObjectsService', $options) ? $options['entryToObjectsService'] : null,
169
            array_key_exists('moduleOptions', $options) ? $options['moduleOptions'] : null,
170
            array_key_exists('mvcEvent', $options) ? $options['mvcEvent'] : null,
171
            array_key_exists('log', $options) ? $options['log'] : null
172
        ];
173
        call_user_func_array([$this, 'init'], $initOptions);
174
    }
175
176
    /**
177
     * @param EntryToObjectsService $entryToObjectsService
178
     * @param ModuleOptions         $moduleOptions
179
     * @param MvcEvent              $mvcEvent
180
     * @param LoggerInterface       $log
181
     */
182
    protected function init(
183
        EntryToObjectsService $entryToObjectsService,
184
        ModuleOptions $moduleOptions,
185
        MvcEvent $mvcEvent,
186
        LoggerInterface $log
187
    ) {
188
        $this->setEntryToObjectsService($entryToObjectsService);
189
        $this->setModuleOptions($moduleOptions);
190
        $this->setMvcEvent($mvcEvent);
191
        $this->setLog($log);
192
    }
193
194
    /**
195
     * @param EventManagerInterface $events
196
     */
197
    public function attach(EventManagerInterface $events)
198
    {
199
        $events->getSharedManager()->attach(RouteHandler::class, ResolveEntryIdEventInterface::RESOLVE_ENTRY_ID_EVENT, [$this, 'onResolveEntryId'], 80);
200
    }
201
202
    /**
203
     * Обработчик содержащий логику получения entryId
204
     *
205
     * @param ResolveEntryIdEventInterface $resolveEntryIdEvent
206
     *
207
     *
208
     * @return null|string
209
     *
210
     * @throws \OldTown\Workflow\ZF2\Toolkit\EntryToObjects\Exception\InvalidGetEntryByObjectsInfoException
211
     * @throws \OldTown\Workflow\ZF2\Toolkit\WorkflowRunParams\Exception\InvalidWorkflowEntryToObjectMetadataException
212
     * @throws \Zend\Serializer\Exception\ExceptionInterface
213
     */
214
    public function onResolveEntryId(ResolveEntryIdEventInterface $resolveEntryIdEvent)
215
    {
216
        $this->getLog()->info(
217
            'Getting "entryId" Workflow to run, based on the data of the object bound to the process'
218
        );
219
220
        $index = $this->getIndexMetadata();
221
222
        $managerName = $resolveEntryIdEvent->getManagerName();
223
        $managerAlias = $resolveEntryIdEvent->getManagerAlias();
224
        $workflowName = $resolveEntryIdEvent->getWorkflowName();
225
226
        $routeMatch = $this->getMvcEvent()->getRouteMatch();
227
        $routerName = $routeMatch->getMatchedRouteName();
228
229
        $indexKeys = $this->buildIndexKeys($routerName, $workflowName, $managerName, $managerAlias);
230
231
        $metadata = null;
232
        foreach ($indexKeys as $indexKey) {
233
            if (array_key_exists($indexKey, $index)) {
234
                $metadata = $index[$indexKey];
235
                break;
236
            }
237
        }
238
239
        if (null === $metadata) {
240
            $this->getLog()->info(
241
                'Metadata for "entryId" not found'
242
            );
243
            return null;
244
        }
245
246
        $objectsInfo = [];
247
248
        foreach ($metadata as $entityClassName => $metadataItem) {
249
            $objectsInfo[$entityClassName] = [];
250
            foreach ($metadataItem as $propertyName => $info) {
251
                $mode = $info[static::MODE];
252
                $paramName = $info[static::PARAM_NAME];
253
254
                $idValue = null;
255
                if (static::MODE_ROUTER_PARAM === $mode) {
256
                    $idValue = $routeMatch->getParam($paramName, null);
257
                }
258
259
                if (static::MODE_QUERY === $mode) {
260
                    $request = $this->getMvcEvent()->getRequest();
261
                    if ($request instanceof Request) {
262
                        $idValue = $request->getQuery($paramName, null);
263
                    }
264
                }
265
266
                if (null === $idValue) {
267
                    $errMsg = sprintf('Error getting the primary identifier for the entity\'s key. Source: %s. Value: %s', $mode, $paramName);
268
                    throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg);
269
                }
270
                $objectsInfo[$entityClassName][$propertyName] = $idValue;
271
            }
272
        }
273
274
        $entry = $this->getEntryToObjectsService()->getEntryByObjectsInfo($managerName, $workflowName, $objectsInfo);
275
276
        if (null === $entry) {
277
            return null;
278
        }
279
280
        return $entry->getId();
281
    }
282
283
    /**
284
     * Подготавливает набор ключей для поиска в индексе
285
     *
286
     * @param string $routerName
287
     * @param string $workflowName
288
     * @param null   $managerName
289
     * @param null   $managerAlias
290
     *
291
     * @return array
292
     */
293
    public function buildIndexKeys($routerName, $workflowName, $managerName = null, $managerAlias = null)
294
    {
295
        $keys = [];
296
297
        $prefixes =[];
298
        if (null !== $managerAlias) {
299
            $prefixes[] = sprintf('alias_%s_%s_', $managerAlias, $workflowName);
300
        }
301
        if (null !== $managerName) {
302
            $prefixes[] = sprintf('name_%s_%s_', $managerName, $workflowName);
303
        }
304
305
        $prepareRouteParts = [];
306
        $stackRouteParts = explode('/', $routerName);
307
308
        for ($i = count($stackRouteParts); $i >= 1; $i--) {
309
            $routeParts = array_slice($stackRouteParts, 0, $i);
310
            $prepareRouteParts[] = implode('/', $routeParts);
311
        }
312
313
        foreach ($prefixes as $prefix) {
314
            foreach ($prepareRouteParts as $prepareRoutePart) {
315
                $keys[] = $prefix . $prepareRoutePart;
316
            }
317
        }
318
319
        return $keys;
320
    }
321
322
    /**
323
     * @return array|null
324
     *
325
     * @throws Exception\InvalidWorkflowEntryToObjectMetadataException
326
     */
327
    public function getIndexMetadata()
328
    {
329
        if (null !== $this->indexMetadata) {
330
            return $this->indexMetadata;
331
        }
332
        $metadata = $this->getModuleOptions()->getWorkflowEntryToObjectMetadata();
333
334
        $index = [];
335
        foreach ($metadata as $metadataItem) {
336 View Code Duplication
            if (!array_key_exists(static::WORKFLOW_MANAGER_NAME, $metadataItem) && !array_key_exists(static::WORKFLOW_MANAGER_ALIAS, $metadataItem)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
337
                $errMsg = sprintf(
338
                    'You must specify the %s or %s',
339
                    static::WORKFLOW_MANAGER_NAME,
340
                    static::WORKFLOW_MANAGER_ALIAS
341
                );
342
                throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg);
343
            }
344
345 View Code Duplication
            if (array_key_exists(static::WORKFLOW_MANAGER_NAME, $metadataItem) && array_key_exists(static::WORKFLOW_MANAGER_ALIAS, $metadataItem)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
346
                $errMsg = sprintf(
347
                    'You can not specify both %s and %s',
348
                    static::WORKFLOW_MANAGER_NAME,
349
                    static::WORKFLOW_MANAGER_ALIAS
350
                );
351
                throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg);
352
            }
353
354 View Code Duplication
            if (!array_key_exists(static::WORKFLOW_NAME, $metadataItem)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
355
                $errMsg = sprintf('there is no option %s', static::WORKFLOW_NAME);
356
                throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg);
357
            }
358
            $workflowName = $metadataItem[static::WORKFLOW_NAME];
359
360 View Code Duplication
            if (!array_key_exists(static::ROUTER_NAME, $metadataItem)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
361
                $errMsg = sprintf('there is no option %s', static::ROUTER_NAME);
362
                throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg);
363
            }
364
            $routerName = $metadataItem[static::ROUTER_NAME];
365
366
            $prefix = '';
367 View Code Duplication
            if (array_key_exists(static::WORKFLOW_MANAGER_NAME, $metadataItem)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
368
                $prefix = 'name_' . $metadataItem[static::WORKFLOW_MANAGER_NAME] . '_';
369
            }
370
371 View Code Duplication
            if (array_key_exists(static::WORKFLOW_MANAGER_ALIAS, $metadataItem)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
372
                $prefix = 'alias_' . $metadataItem[static::WORKFLOW_MANAGER_ALIAS] . '_';
373
            }
374
375
            $uniqueKey = $prefix . $workflowName . '_' . $routerName;
376
377
            if (array_key_exists($uniqueKey, $index)) {
378
                $errMsg = sprintf('Index contains duplicate keys %s', $uniqueKey);
379
                throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg);
380
            }
381
382
            $index[$uniqueKey] = [];
383
384
385 View Code Duplication
            if (!array_key_exists(static::MAP, $metadataItem)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
386
                $errMsg = sprintf('there is no option %s', static::MAP);
387
                throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg);
388
            }
389 View Code Duplication
            if (!is_array($metadataItem[static::MAP])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
390
                $errMsg = sprintf('option %s is not array', static::MAP);
391
                throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg);
392
            }
393
            $map = $metadataItem[static::MAP];
394
395
            foreach ($map as $mapItem) {
396 View Code Duplication
                if (!array_key_exists(static::ENTITY_CLASS_NAME, $mapItem)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
397
                    $errMsg = sprintf('there is no option %s', static::ENTITY_CLASS_NAME);
398
                    throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg);
399
                }
400
                $entityClassName = $mapItem[static::ENTITY_CLASS_NAME];
401
402 View Code Duplication
                if (array_key_exists($entityClassName, $index[$uniqueKey])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
403
                    $errMsg = sprintf('Metadata for entities already exist %s', $mapItem[static::ENTITY_CLASS_NAME]);
404
                    throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg);
405
                }
406
                $index[$uniqueKey][$entityClassName] = [];
407
408 View Code Duplication
                if (!array_key_exists(static::IDENTIFIERS_MAP, $mapItem)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
409
                    $errMsg = sprintf('there is no option %s', static::IDENTIFIERS_MAP);
410
                    throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg);
411
                }
412 View Code Duplication
                if (!is_array($mapItem[static::IDENTIFIERS_MAP])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
413
                    $errMsg = sprintf('option %s is not array', static::IDENTIFIERS_MAP);
414
                    throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg);
415
                }
416
417
                $identifiersMap = $mapItem[static::IDENTIFIERS_MAP];
418
419
                foreach ($identifiersMap as $identifierItem) {
420 View Code Duplication
                    if (!array_key_exists(static::PROPERTY_NAME, $identifierItem)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
421
                        $errMsg = sprintf('there is no option %s', static::PROPERTY_NAME);
422
                        throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg);
423
                    }
424
                    $propertyName = $identifierItem[static::PROPERTY_NAME];
425
426 View Code Duplication
                    if (array_key_exists($propertyName, $index[$uniqueKey][$entityClassName])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
427
                        $errMsg = sprintf('Metadata for property already exist %s', $propertyName);
428
                        throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg);
429
                    }
430
                    $index[$uniqueKey][$entityClassName][$propertyName] = [];
431
432
                    $modeOriginal = array_key_exists(static::MODE, $identifierItem) ? $identifierItem[static::MODE] : static ::MODE_ROUTER_PARAM;
433
                    $mode = strtolower($modeOriginal);
434
435
                    if (!array_key_exists($mode, $this->accessMode)) {
436
                        $errMsg = sprintf('Invalid value for the "mode" %s', $mode);
437
                        throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg);
438
                    }
439
                    $index[$uniqueKey][$entityClassName][$propertyName][static::MODE] = $mode;
440
441 View Code Duplication
                    if (!array_key_exists(static::PARAM_NAME, $identifierItem)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
442
                        $errMsg = sprintf('there is no option %s', static::PARAM_NAME);
443
                        throw new Exception\InvalidWorkflowEntryToObjectMetadataException($errMsg);
444
                    }
445
                    $paramName = $identifierItem[static::PARAM_NAME];
446
                    $index[$uniqueKey][$entityClassName][$propertyName][static::PARAM_NAME] = $paramName;
447
                }
448
            }
449
        }
450
451
        $this->indexMetadata = $index;
452
453
        return $this->indexMetadata;
454
    }
455
456
    /**
457
     * @param array|null $indexMetadata
458
     *
459
     * @return $this
460
     */
461
    public function setIndexMetadata(array $indexMetadata = null)
462
    {
463
        $this->indexMetadata = $indexMetadata;
464
465
        return $this;
466
    }
467
468
469
    /**
470
     * Сервис реализующий функционал, для привязки процессов wf и информации о объектаъ
471
     *
472
     * @return EntryToObjectsService
473
     */
474
    public function getEntryToObjectsService()
475
    {
476
        return $this->entryToObjectsService;
477
    }
478
479
    /**
480
     * Устанавливает сервис реализующий функционал, для привязки процессов wf и информации о объектаъ
481
     *
482
     * @param EntryToObjectsService $entryToObjectsService
483
     *
484
     * @return $this
485
     */
486
    public function setEntryToObjectsService(EntryToObjectsService $entryToObjectsService)
487
    {
488
        $this->entryToObjectsService = $entryToObjectsService;
489
490
        return $this;
491
    }
492
493
    /**
494
     * Настройки модуля
495
     *
496
     * @return ModuleOptions
497
     */
498
    public function getModuleOptions()
499
    {
500
        return $this->moduleOptions;
501
    }
502
503
    /**
504
     * Устанавливает настройки модуля
505
     *
506
     * @param ModuleOptions $moduleOptions
507
     *
508
     * @return $this
509
     */
510
    public function setModuleOptions(ModuleOptions $moduleOptions)
511
    {
512
        $this->moduleOptions = $moduleOptions;
513
514
        return $this;
515
    }
516
517
    /**
518
     * @return MvcEvent
519
     */
520
    public function getMvcEvent()
521
    {
522
        return $this->mvcEvent;
523
    }
524
525
    /**
526
     * @param MvcEvent $mvcEvent
527
     *
528
     * @return $this
529
     */
530
    public function setMvcEvent(MvcEvent $mvcEvent)
531
    {
532
        $this->mvcEvent = $mvcEvent;
533
534
        return $this;
535
    }
536
537
538
    /**
539
     * Устанавливает логер
540
     *
541
     * @return LoggerInterface
542
     */
543
    public function getLog()
544
    {
545
        return $this->log;
546
    }
547
548
    /**
549
     * Возвращает логер
550
     *
551
     * @param LoggerInterface $log
552
     *
553
     * @return $this
554
     */
555
    public function setLog(LoggerInterface $log)
556
    {
557
        $this->log = $log;
558
559
        return $this;
560
    }
561
}
562