FromInitializer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 9 2
1
<?php
2
3
namespace Underscore\Initializer;
4
5
use Underscore\Collection;
6
use Underscore\Initializer;
7
use Underscore\Underscore;
8
9
class FromInitializer extends Initializer
10
{
11
    /**
12
     * Initializes Underscore object and sets argument as internal collection
13
     *
14
     * @param mixed $item
15
     * @return Underscore
16
     */
17 47
    public function __invoke($item)
18
    {
19 47
        if ($item instanceof Collection) {
20 1
            $item = clone $item;
21
        } else {
22 46
            $item = new Collection($item);
23
        }
24 47
        return new Underscore($item);
25
    }
26
}
27