Completed
Push — master ( 269014...5eca8b )
by Андрей
02:50 queued 54s
created

ResolverByMapFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 0 10 2
1
<?php
2
/**
3
 * @link    https://github.com/nnx-framework/entry-name-resolver
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace Nnx\EntryNameResolver;
7
8
use Zend\ServiceManager\FactoryInterface;
9
use Zend\ServiceManager\MutableCreationOptionsInterface;
10
use Zend\ServiceManager\ServiceLocatorInterface;
11
use Zend\ServiceManager\MutableCreationOptionsTrait;
12
13
/**
14
 * Class ResolverByMapFactory
15
 *
16
 * @package Nnx\EntryNameResolver\EntryNameResolver
17
 */
18
class ResolverByMapFactory implements FactoryInterface, MutableCreationOptionsInterface
19
{
20
    use MutableCreationOptionsTrait;
21
22
    /**
23
     * @inheritdoc
24
     *
25
     * @param ServiceLocatorInterface $serviceLocator
26
     *
27
     * @return ResolverByMap
28
     *
29
     */
30
    public function createService(ServiceLocatorInterface $serviceLocator)
31
    {
32
        $creationOptions = $this->getCreationOptions();
33
        $options = is_array($creationOptions) ? $creationOptions : [];
0 ignored issues
show
Unused Code introduced by
$options is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
34
35
36
37
38
        return new ResolverByMap();
39
    }
40
}
41