Completed
Pull Request — master (#615)
by Filippo
14:02 queued 03:29
created

UniqueObjectFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 20
ccs 9
cts 9
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 15 2
1
<?php
2
3
4
namespace DoctrineModule\Validator\Service;
5
6
use Interop\Container\ContainerInterface;
7
use DoctrineModule\Validator\UniqueObject;
8
9
class UniqueObjectFactory extends AbstractValidatorFactory
10
{
11
    protected $validatorClass = UniqueObject::class;
12
13 1
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
14
    {
15 1
        $container = $this->container($container);
16
17 1
        $useContext = isset($options['use_context']) ? (boolean) $options['use_context'] : false;
18
19 1
        $validator = new UniqueObject($this->merge($options, [
20 1
            'object_manager'    => $this->getObjectManager($container, $options),
21 1
            'use_context'       => $useContext,
22 1
            'object_repository' => $this->getRepository($container, $options),
23 1
            'fields'            => $this->getFields($options),
24
        ]));
25
26 1
        return $validator;
27
    }
28
}
29