Passed
Push — master ( afdec1...60a2b8 )
by Chris
07:28
created

StandardList::insert()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 9
ccs 5
cts 5
cp 1
rs 10
cc 2
nc 2
nop 3
crap 2
1
<?php
2
3
namespace WebTheory\Collection\Driver;
4
5
use WebTheory\Collection\Contracts\ArrayDriverInterface;
6
use WebTheory\Collection\Driver\Abstracts\AbstractArrayDriver;
7
8
class StandardList extends AbstractArrayDriver implements ArrayDriverInterface
9
{
10 75
    public function insert(array &$array, object $item, $locator = null): bool
11
    {
12 75
        if ($this->arrayContainsObject($array, $item)) {
13 8
            return false;
14
        }
15
16 75
        $array[] = $item;
17
18 75
        return true;
19
    }
20
}
21