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

Collection   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A whereIn() 0 6 1
A reset() 0 6 1
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