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

ObjectExistsFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 13 1
1
<?php
2
3
4
namespace DoctrineModule\Validator\Service;
5
6
use Interop\Container\ContainerInterface;
7
use DoctrineModule\Validator\ObjectExists;
8
9
/**
10
 * Factory for creating ObjectExists instances
11
 *
12
 * @license MIT
13
 * @link    http://www.doctrine-project.org/
14
 * @since   1.3.0
15
 * @author  Fabian Grutschus <[email protected]>
16
 */
17
class ObjectExistsFactory extends AbstractValidatorFactory
18
{
19
    protected $validatorClass = ObjectExists::class;
20
21 1
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
22
    {
23 1
        $container = $this->container($container);
24
25 1
        $repository = $this->getRepository($container, $options);
0 ignored issues
show
Bug introduced by
It seems like $options defined by parameter $options on line 21 can also be of type null; however, DoctrineModule\Validator...actory::getRepository() does only seem to accept array, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
26
27 1
        $validator = new ObjectExists($this->merge($options, [
0 ignored issues
show
Bug introduced by
It seems like $options defined by parameter $options on line 21 can also be of type null; however, DoctrineModule\Validator...lidatorFactory::merge() does only seem to accept array, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
28 1
            'object_repository' => $repository,
29 1
            'fields'            => $this->getFields($options),
0 ignored issues
show
Bug introduced by
It seems like $options defined by parameter $options on line 21 can also be of type null; however, DoctrineModule\Validator...torFactory::getFields() does only seem to accept array, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
30
        ]));
31
32 1
        return $validator;
33
    }
34
}
35