Passed
Pull Request — master (#14)
by Pavel
03:16
created

ConstructorFactoryResolver::resolve()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 7
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 6
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