EntityValidatorFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 23
c 0
b 0
f 0
wmc 2
lcom 0
cbo 3
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 8 1
1
<?php
2
/**
3
 * @license See the file LICENSE for copying permission
4
 */
5
6
namespace Thorr\Persistence\Factory;
7
8
use Thorr\Persistence\DataMapper\Manager\DataMapperManager;
9
use Zend\ServiceManager\MutableCreationOptionsInterface;
10
use Zend\ServiceManager\MutableCreationOptionsTrait;
11
use Zend\Validator\ValidatorPluginManager;
12
13
class EntityValidatorFactory implements MutableCreationOptionsInterface
14
{
15
    use MutableCreationOptionsTrait;
16
17
    private $validatorClass;
18
19
    /**
20
     * @param $validatorClass
21
     */
22 4
    public function __construct($validatorClass)
23
    {
24 4
        $this->validatorClass = (string) $validatorClass;
25 4
    }
26
27 1
    public function __invoke(ValidatorPluginManager $validatorPluginManager)
28
    {
29 1
        $dmm = $validatorPluginManager->getServiceLocator()->get(DataMapperManager::class);
30
31 1
        $class = $this->validatorClass;
32
33 1
        return new $class($this->getCreationOptions(), $dmm);
34
    }
35
}
36