ArrayHelper   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 21
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A firstValue() 0 10 3
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://github.com/flipbox/spark/blob/master/LICENSE
6
 * @link       https://github.com/flipbox/spark
7
 */
8
9
namespace flipbox\spark\helpers;
10
11
use craft\helpers\ArrayHelper as BaseArrayHelper;
12
13
/**
14
 * @author Flipbox Factory <[email protected]>
15
 * @since 1.0.0
16
 */
17
class ArrayHelper extends BaseArrayHelper
18
{
19
20
    /**
21
     * Returns the first value in a given array.
22
     *
23
     * @param array $arr
24
     *
25
     * @return mixed|null
26
     */
27
    public static function firstValue(array $arr)
28
    {
29
        if (is_array($arr)) {
30
            foreach ($arr as $value) {
31
                return $value;
32
            }
33
        }
34
35
        return null;
36
    }
37
}
38