| Conditions | 14 |
| Paths | 480 |
| Total Lines | 83 |
| Code Lines | 55 |
| 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 |
||
| 52 | public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleController $schedulerModule) |
||
| 53 | { |
||
| 54 | $additionalFields = []; |
||
| 55 | |||
| 56 | if (empty($taskInfo['configuration'])) { |
||
| 57 | if ($schedulerModule->CMD == 'add') { |
||
| 58 | $taskInfo['configuration'] = []; |
||
| 59 | } elseif ($schedulerModule->CMD == 'edit') { |
||
| 60 | $taskInfo['configuration'] = $task->configuration; |
||
| 61 | } else { |
||
| 62 | $taskInfo['configuration'] = $task->configuration; |
||
| 63 | } |
||
| 64 | } |
||
| 65 | |||
| 66 | if (empty($taskInfo['startPage'])) { |
||
| 67 | if ($schedulerModule->CMD == 'add') { |
||
| 68 | $taskInfo['startPage'] = 0; |
||
| 69 | if ($task instanceof \TYPO3\CMS\Scheduler\Task\AbstractTask) { |
||
| 70 | $task->startPage = 0; |
||
| 71 | } |
||
| 72 | } elseif ($schedulerModule->CMD == 'edit') { |
||
| 73 | $taskInfo['startPage'] = $task->startPage; |
||
| 74 | } else { |
||
| 75 | $taskInfo['startPage'] = $task->startPage; |
||
| 76 | } |
||
| 77 | } |
||
| 78 | |||
| 79 | if (empty($taskInfo['depth'])) { |
||
| 80 | if ($schedulerModule->CMD == 'add') { |
||
| 81 | $taskInfo['depth'] = []; |
||
| 82 | } elseif ($schedulerModule->CMD == 'edit') { |
||
| 83 | $taskInfo['depth'] = $task->depth; |
||
| 84 | } else { |
||
| 85 | $taskInfo['depth'] = $task->depth; |
||
| 86 | } |
||
| 87 | } |
||
| 88 | |||
| 89 | // input for startPage |
||
| 90 | $fieldId = 'task_startPage'; |
||
| 91 | $fieldCode = '<input name="tx_scheduler[startPage]" type="text" id="' . $fieldId . '" value="' . $task->startPage . '" class="form-control" />'; |
||
| 92 | $additionalFields[$fieldId] = [ |
||
| 93 | 'code' => $fieldCode, |
||
| 94 | 'label' => 'LLL:EXT:crawler/Resources/Private/Language/Backend.xlf:crawler_im.startPage' |
||
| 95 | ]; |
||
| 96 | |||
| 97 | // input for depth |
||
| 98 | $fieldId = 'task_depth'; |
||
| 99 | $fieldValueArray = [ |
||
| 100 | '0' => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_0'), |
||
| 101 | '1' => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_1'), |
||
| 102 | '2' => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_2'), |
||
| 103 | '3' => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_3'), |
||
| 104 | '4' => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_4'), |
||
| 105 | '99' => $GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.depth_infi'), |
||
| 106 | ]; |
||
| 107 | $fieldCode = '<select name="tx_scheduler[depth]" id="' . $fieldId . '" class="form-control">'; |
||
| 108 | |||
| 109 | foreach ($fieldValueArray as $key => $label) { |
||
| 110 | $fieldCode .= "\t" . '<option value="' . $key . '"' . (($key == $task->depth) ? ' selected="selected"' : '') . '>' . $label . '</option>'; |
||
| 111 | } |
||
| 112 | |||
| 113 | $fieldCode .= '</select>'; |
||
| 114 | $additionalFields[$fieldId] = [ |
||
| 115 | 'code' => $fieldCode, |
||
| 116 | 'label' => 'LLL:EXT:crawler/Resources/Private/Language/Backend.xlf:crawler_im.depth' |
||
| 117 | ]; |
||
| 118 | |||
| 119 | // combobox for configuration records |
||
| 120 | $recordsArray = $this->getCrawlerConfigurationRecords(); |
||
| 121 | $fieldId = 'task_configuration'; |
||
| 122 | $fieldCode = '<select name="tx_scheduler[configuration][]" multiple="multiple" id="' . $fieldId . '" class="form-control">'; |
||
| 123 | $fieldCode .= "\t" . '<option value=""></option>'; |
||
| 124 | for ($i = 0; $i < count($recordsArray); $i++) { |
||
| 125 | $fieldCode .= "\t" . '<option ' . $this->getSelectedState($task->configuration, $recordsArray[$i]['name']) . 'value="' . $recordsArray[$i]['name'] . '">' . $recordsArray[$i]['name'] . '</option>'; |
||
| 126 | } |
||
| 127 | $fieldCode .= '</select>'; |
||
| 128 | |||
| 129 | $additionalFields[$fieldId] = [ |
||
| 130 | 'code' => $fieldCode, |
||
| 131 | 'label' => 'LLL:EXT:crawler/Resources/Private/Language/Backend.xlf:crawler_im.conf' |
||
| 132 | ]; |
||
| 133 | |||
| 134 | return $additionalFields; |
||
| 135 | } |
||
| 224 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths