Completed
Push — master ( fe2965...b756cf )
by ARCANEDEV
09:04
created

Collection::mode()   B

Complexity

Conditions 4
Paths 3

Size

Total Lines 22
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 12
c 1
b 0
f 0
nc 3
nop 1
dl 0
loc 22
ccs 11
cts 11
cp 1
crap 4
rs 8.9197
1
<?php namespace Arcanedev\Support;
2
3
use Illuminate\Support\Collection as IlluminateCollection;
4
5
/**
6
 * Class     Collection
7
 *
8
 * @package  Arcanedev\Support
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class Collection extends IlluminateCollection
12
{
13
    /* ------------------------------------------------------------------------------------------------
14
     |  Illuminate Functions
15
     | ------------------------------------------------------------------------------------------------
16
     */
17
    /**
18
     * Filter items by the given key value pair.
19
     *
20
     * @param  string  $key
21
     * @param  array   $values
22
     * @param  bool    $strict
23
     *
24
     * @return static
25
     */
26
    public function whereIn($key, array $values, $strict = true)
27
    {
28 8
        return $this->filter(function ($item) use ($key, $values, $strict) {
29 8
            return in_array(data_get($item, $key), $values, $strict);
30 8
        });
31
    }
32
33
    /* ------------------------------------------------------------------------------------------------
34
     |  Custom Functions
35
     | ------------------------------------------------------------------------------------------------
36
     */
37
    /**
38
     * Reset the collection.
39
     *
40
     * @return self
41
     */
42 8
    public function reset()
43
    {
44 8
        $this->items = [];
45
46 8
        return $this;
47
    }
48
}
49