Passed
Push — master ( 03df52...d88a91 )
by Patrick
13:12
created

Arr::pull()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 1
c 1
b 0
f 0
nc 2
nop 3
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 2
rs 10
1
<?php
2
3
namespace ShiftOneLabs\LaravelSqsFifoQueue\Support;
4
5
use Illuminate\Support\Arr as BaseArr;
6
7
class Arr
8
{
9
    /**
10
     * Get a subset of the items from the given array.
11
     *
12
     * @param  array  $array
13
     * @param  array|string  $keys
14
     *
15
     * @return array
16
     */
17 190
    public static function only($array, $keys)
18
    {
19 190
        return class_exists(BaseArr::class) ? BaseArr::only($array, $keys) : array_only($array, $keys);
0 ignored issues
show
Bug introduced by
The function array_only was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
        return class_exists(BaseArr::class) ? BaseArr::only($array, $keys) : /** @scrutinizer ignore-call */ array_only($array, $keys);
Loading history...
20
    }
21
22
    /**
23
     * Get a value from the array, and remove it.
24
     *
25
     * @param  array   $array
26
     * @param  string  $key
27
     * @param  mixed   $default
28
     *
29
     * @return mixed
30
     */
31 228
    public static function pull(&$array, $key, $default = null)
32
    {
33 228
        return class_exists(BaseArr::class) ? BaseArr::pull($array, $key, $default) : array_pull($array, $key, $default);
0 ignored issues
show
Bug introduced by
The function array_pull was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
        return class_exists(BaseArr::class) ? BaseArr::pull($array, $key, $default) : /** @scrutinizer ignore-call */ array_pull($array, $key, $default);
Loading history...
34
    }
35
36
    /**
37
     * Get an item from an array using "dot" notation.
38
     *
39
     * @param  \ArrayAccess|array  $array
40
     * @param  string|int  $key
41
     * @param  mixed   $default
42
     *
43
     * @return mixed
44
     */
45 646
    public static function get($array, $key, $default = null)
46
    {
47 646
        return class_exists(BaseArr::class) ? BaseArr::get($array, $key, $default) : array_get($array, $key, $default);
0 ignored issues
show
Bug introduced by
The function array_get was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

47
        return class_exists(BaseArr::class) ? BaseArr::get($array, $key, $default) : /** @scrutinizer ignore-call */ array_get($array, $key, $default);
Loading history...
48
    }
49
}
50