Completed
Pull Request — master (#14)
by Pavel
04:00
created

ConstructorFactoryResolver   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 8 2
1
<?php
2
3
namespace Bankiru\Api\Doctrine;
4
5
use Bankiru\Api\Doctrine\ApiFactory\StaticApiFactoryFactory;
6
7
final class ConstructorFactoryResolver implements ApiFactoryResolverInterface
8
{
9
    /** @var  ApiFactoryInterface[] */
10
    private $factories = [];
11
12
    /** {@inheritdoc} */
13
    public function resolve($name)
14
    {
15
        if (!array_key_exists($name, $this->factories)) {
16
            $this->factories[$name] = new StaticApiFactoryFactory($name);
0 ignored issues
show
Unused Code introduced by
The call to StaticApiFactoryFactory::__construct() has too many arguments starting with $name.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
17
        }
18
19
        return $this->factories[$name];
20
    }
21
}
22