Completed
Push — master ( 463ede...2a793d )
by Gallice
03:25
created

Helper   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

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 5
cts 5
cp 1
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 2
    public static function getFirstEntityValue($entityName, array $entities)
14
    {
15 2
        if (!isset($entities[$entityName][0]['value'])) {
16 1
            return null;
17
        }
18
19 1
        $val = $entities[$entityName][0]['value'];
20
21 1
        return is_array($val) && isset($val['value']) ? $val['value'] : $val;
22
    }
23
}
24