Conditions | 10 |
Paths | 9 |
Total Lines | 27 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
109 | private static function validate($relations_array) |
||
110 | { |
||
111 | if (is_array($relations_array)) { |
||
112 | $return = TRUE; |
||
113 | foreach ($relations_array as $relations) { |
||
114 | if (is_array($relations)) { |
||
115 | foreach ($relations as $relation) { |
||
116 | if (!(is_array($relation) && (count($relation) == 2) && isset($relation[0]) && isset($relation[1]))) { |
||
117 | $return = FALSE; |
||
118 | break; |
||
119 | } |
||
120 | } |
||
121 | |||
122 | if ($return === FALSE) { |
||
123 | break; |
||
124 | } |
||
125 | } else { |
||
126 | $return = FALSE; |
||
127 | break; |
||
128 | } |
||
129 | } |
||
130 | |||
131 | return $return; |
||
132 | } else { |
||
133 | return FALSE; |
||
134 | } |
||
135 | } |
||
136 | } |
||
137 |