ExtendMutator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 3
c 3
b 0
f 0
lcom 0
cbo 1
dl 0
loc 29
ccs 8
cts 8
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 15 3
1
<?php
2
3
namespace Underscore\Mutator;
4
5
use Underscore\Collection;
6
use Underscore\Mutator;
7
8
class ExtendMutator extends Mutator
9
{
10
    /**
11
     * Copy all of the properties in the source objects over to the destination object.
12
     *
13
     * It's in-order, so the last source will override properties of the same name
14
     * in previous arguments.
15
     *
16
     * @param Collection $collection
17
     * @param mixed      $source
18
     * @param ...
19
     * @return Collection
20
     */
21 1
    public function __invoke($collection, $source)
0 ignored issues
show
Unused Code introduced by
The parameter $source is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
22
    {
23 1
        $sources = func_get_args();
24 1
        array_shift($sources); // remove $collection
25
26 1
        $collection = clone $collection;
27
28 1
        foreach ($sources as $source) {
29 1
            foreach ($source as $key => $value) {
30 1
                $collection[$key] = $value;
31
            }
32
        }
33
34 1
        return $collection;
35
    }
36
}
37