UniqueObjectFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

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