Module   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 0 Features 2
Metric Value
wmc 3
c 4
b 0
f 2
lcom 0
cbo 3
dl 0
loc 52
ccs 20
cts 20
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getValidatorConfig() 0 9 1
A init() 0 15 1
A getServiceConfig() 0 11 1
1
<?php
2
/**
3
 * @author Stefano Torresi (http://stefanotorresi.it)
4
 * @license See the file LICENSE.txt for copying permission.
5
 * ************************************************
6
 */
7
8
namespace Thorr\Persistence;
9
10
use Zend\ModuleManager\Feature;
11
use Zend\ModuleManager\Listener\ServiceListenerInterface;
12
use Zend\ModuleManager\ModuleManagerInterface;
13
use Zend\ServiceManager\ServiceManager;
14
15
class Module implements
16
    Feature\ValidatorProviderInterface,
17
    Feature\InitProviderInterface,
18
    Feature\ServiceProviderInterface
19
{
20
    /**
21
     * {@inheritdoc}
22
     */
23 4
    public function init(ModuleManagerInterface $moduleManager)
24
    {
25
        /** @var ServiceManager $serviceManager */
26 4
        $serviceManager = $moduleManager->getEvent()->getParam('ServiceManager');
0 ignored issues
show
Bug introduced by
The method getEvent() does not exist on Zend\ModuleManager\ModuleManagerInterface. Did you maybe mean getEventManager()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
27
28
        /** @var ServiceListenerInterface $serviceListener */
29 4
        $serviceListener = $serviceManager->get('ServiceListener');
30
31 4
        $serviceListener->addServiceManager(
32 4
            DataMapper\Manager\DataMapperManager::class,
33 4
            'thorr_persistence_dmm',
34 4
            DataMapper\Manager\DataMapperManagerConfigProviderInterface::class,
35
            'getDataMapperManagerConfig'
36 4
        );
37 4
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42 4
    public function getServiceConfig()
43
    {
44
        return [
45
            'factories' => [
46 4
                DataMapper\Manager\DataMapperManager::class => DataMapper\Manager\DataMapperManagerFactory::class,
47 4
            ],
48
            'aliases' => [
49 4
                'DataMapperManager' => DataMapper\Manager\DataMapperManager::class,
50 4
            ],
51 4
        ];
52
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57 4
    public function getValidatorConfig()
58
    {
59
        return [
60
            'factories' => [
61 4
                Validator\EntityExistsValidator::class    => new Factory\EntityValidatorFactory(Validator\EntityExistsValidator::class),
62 4
                Validator\EntityNotExistsValidator::class => new Factory\EntityValidatorFactory(Validator\EntityNotExistsValidator::class),
63 4
            ],
64 4
        ];
65
    }
66
}
67