Completed
Push — master ( 125b2c...072910 )
by Vitaliy
02:55
created

ArrayDataRow   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B extractCellValue() 0 21 5
1
<?php
2
namespace Nayjest\Grids;
3
4
class ArrayDataRow extends DataRow
5
{
6
    /**
7
     * {@inheritdoc}
8
     */
9
    protected function extractCellValue($fieldName)
10
    {
11
        if (strpos($fieldName, '.') !== false) {
12
            $parts = explode('.', $fieldName);
13
            $res = $this->src;
14
            foreach ($parts as $part) {
15
                if (isset($res[$part])) {
16
                    $res = $res[$part];
17
                } else {
18
                    return $res;
19
                }
20
            }
21
            return $res;
22
        } else {
23
            if (array_key_exists($fieldName, $this->src)) {
24
                return $this->src[$fieldName];
25
            } else {
26
                return null;
27
            }
28
        }
29
    }
30
}
31