Passed
Push — master ( 204e2b...dee98e )
by Gallice
03:34
created

Helper   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 19
ccs 0
cts 8
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getFirstEntityValue() 0 10 4
1
<?php
2
3
namespace Tgallice\Wit;
4
5
class Helper
6
{
7
    /**
8
     * @param $entityName
9
     * @param array $entities
10
     *
11
     * @return mixed
12
     */
13
    public static function getFirstEntityValue($entityName, array $entities)
14
    {
15
        if (!isset($entities[$entityName][0]['value'])) {
16
            return null;
17
        }
18
19
        $val = $entities[$entityName][0]['value'];
20
21
        return is_array($val) && isset($val['value']) ? $val['value'] : $val;
22
    }
23
}
24