ArrayHelper   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 15
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A ensure() 0 7 3
1
<?php
2
namespace phphound\helper;
3
4
/**
5
 * Array helper.
6
 */
7
class ArrayHelper
8
{
9
    /**
10
     * Ensure the value is an array. If it is not, return an empty array.
11
     * @param Mixed $value value to be verified.
12
     * @return array value itself or an empty array.
13
     */
14
    public static function ensure($value)
15
    {
16
        if (empty($value) || !is_array($value)) {
17
            return [];
18
        }
19
        return $value;
20
    }
21
}
22