| Conditions | 11 |
| Paths | 18 |
| Total Lines | 47 |
| Code Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 46 | public function getFlexFormDS_postProcessDS(&$flexFormArray, $conf, $row, $table, $fieldName) |
||
| 47 | { |
||
| 48 | $flag = false; |
||
| 49 | |||
| 50 | foreach (self::$handledTables as $handledTable => $handledField) { |
||
| 51 | if ($handledTable === $table |
||
| 52 | && $handledField === $fieldName |
||
| 53 | && 0 !== $row['sys_language_uid'] |
||
| 54 | ) { |
||
| 55 | $flag = true; |
||
| 56 | break; |
||
| 57 | } |
||
| 58 | } |
||
| 59 | |||
| 60 | if (!$flag) { |
||
| 61 | return; |
||
| 62 | } |
||
| 63 | |||
| 64 | $parent = $this->getDatabaseConnection() |
||
| 65 | ->exec_SELECTgetSingleRow( |
||
| 66 | 'event', |
||
| 67 | $table, |
||
| 68 | 'uid=' . (int)$row['l10n_parent'] |
||
| 69 | ); |
||
| 70 | |||
| 71 | if (!$parent) { |
||
| 72 | return; |
||
| 73 | } |
||
| 74 | |||
| 75 | $event = $parent['event']; |
||
| 76 | |||
| 77 | if (!isset($conf['ds'][$event])) { |
||
| 78 | return; |
||
| 79 | } |
||
| 80 | |||
| 81 | $ds = $conf['ds'][$event]; |
||
| 82 | |||
| 83 | if (substr($ds, 0, 5) == 'FILE:') { |
||
| 84 | $file = GeneralUtility::getFileAbsFileName(substr($ds, 5)); |
||
| 85 | |||
| 86 | if ($file && @is_file($file)) { |
||
| 87 | $flexFormArray = GeneralUtility::xml2array(GeneralUtility::getUrl($file)); |
||
|
|
|||
| 88 | } else { |
||
| 89 | $flexFormArray = 'The file "' . substr($ds, 5) . '" in ds-array key "' . $event . '" was not found ("' . $file . '")'; |
||
| 90 | } |
||
| 91 | } else { |
||
| 92 | $flexFormArray = GeneralUtility::xml2array($ds); |
||
| 93 | } |
||
| 104 |