MapManager   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 61.29 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 3
c 2
b 0
f 2
lcom 0
cbo 1
dl 19
loc 31
ccs 11
cts 11
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 6 6 1
A remove() 0 9 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Accessible\MethodManager;
4
5 View Code Duplication
class MapManager extends CollectionManager
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
6
{
7
    /**
8
     * Adds an element to the map.
9
     *
10
     * @param array|Traversable $map
11
     * @param array $args
12
     */
13 3
    public static function add(&$map, $args)
14
    {
15 3
        self::assertArgsNumber(2, $args);
16
17 2
        $map[$args[0]] = $args[1];
18 2
    }
19
20
    /**
21
     * Removes an element from the map.
22
     *
23
     * @param  array|Traversable $map
24
     * @param  array $args
25
     */
26 1
    public static function remove(&$map, $args)
27
    {
28 1
        self::assertArgsNumber(1, $args);
29
30 1
        $key = $args[0];
31 1
        if (isset($map[$key])) {
32 1
            unset($map[$key]);
33 1
        }
34 1
    }
35
}
36