Completed
Push — master ( 0ba342...c36cc2 )
by Adam
18s
created

Arr::wrap()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 3
nc 3
nop 1
1
<?php
2
3
namespace Endeavors\Components\Routing;
4
5
use Illuminate\Support\Arr as BaseArr;
6
7
class Arr extends BaseArr
8
{
9
    /**
10
     * If the given value is not an array and not null, wrap it in one.
11
     *
12
     * @param  mixed  $value
13
     * @return array
14
     */
15
    public static function wrap($value)
16
    {
17
        if (is_null($value)) {
18
            return [];
19
        }
20
21
        return ! is_array($value) ? [$value] : $value;
22
    }
23
}