Conditions | 7 |
Paths | 8 |
Total Lines | 36 |
Code Lines | 26 |
Lines | 0 |
Ratio | 0 % |
Changes | 5 | ||
Bugs | 3 | Features | 2 |
1 | <?php |
||
17 | protected function extractCellValue($fieldName) |
||
18 | { |
||
19 | if (strpos($fieldName, '.') !== false) { |
||
20 | $parts = explode('.', $fieldName); |
||
21 | $parts = array_reverse($parts); |
||
22 | $res = $this->src; |
||
23 | try { |
||
24 | foreach ($parts as $part) { |
||
25 | $res = is_object($res) ? $res->{$part} : $res[$part]; |
||
26 | if ($res !== null) { |
||
27 | return $res; |
||
28 | } |
||
29 | } |
||
30 | } catch (Exception $e) { |
||
31 | throw new RuntimeException( |
||
32 | "Can't read '$fieldName' as '$part' property from DataRow", |
||
33 | 0, |
||
34 | $e |
||
35 | ); |
||
36 | } |
||
37 | throw new RuntimeException( |
||
38 | "Can't read '$fieldName' property from DataRow", |
||
39 | 0 |
||
40 | ); |
||
41 | } else { |
||
42 | try { |
||
43 | return $this->src->{$fieldName}; |
||
44 | } catch (Exception $e) { |
||
|
|||
45 | throw new RuntimeException( |
||
46 | "Can't read '$fieldName' property from DataRow", |
||
47 | 0, |
||
48 | $e |
||
49 | ); |
||
50 | } |
||
51 | } |
||
52 | } |
||
53 | } |
||
54 |
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return
,die
orexit
statements that have been added for debug purposes.In the above example, the last
return false
will never be executed, because a return statement has already been met in every possible execution path.