Conditions | 10 |
Paths | 64 |
Total Lines | 56 |
Code Lines | 38 |
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 |
||
51 | public function getAdditionalFields(array &$taskInfo, $task, SchedulerModuleController $schedulerModule) |
||
52 | { |
||
53 | $additionalFields = []; |
||
54 | |||
55 | if (empty($taskInfo['sleepTime'])) { |
||
56 | if ($schedulerModule->CMD == 'add') { |
||
57 | $taskInfo['sleepTime'] = 1000; |
||
58 | } elseif ($schedulerModule->CMD == 'edit') { |
||
59 | $taskInfo['sleepTime'] = $task->sleepTime; |
||
60 | } else { |
||
61 | $taskInfo['sleepTime'] = $task->sleepTime; |
||
62 | } |
||
63 | } |
||
64 | |||
65 | if (empty($taskInfo['sleepAfterFinish'])) { |
||
66 | if ($schedulerModule->CMD == 'add') { |
||
67 | $taskInfo['sleepAfterFinish'] = 10; |
||
68 | } elseif ($schedulerModule->CMD == 'edit') { |
||
69 | $taskInfo['sleepAfterFinish'] = $task->sleepAfterFinish; |
||
70 | } else { |
||
71 | $taskInfo['sleepAfterFinish'] = $task->sleepAfterFinish; |
||
72 | } |
||
73 | } |
||
74 | if (empty($taskInfo['countInARun'])) { |
||
75 | if ($schedulerModule->CMD == 'add') { |
||
76 | $taskInfo['countInARun'] = 100; |
||
77 | } elseif ($schedulerModule->CMD == 'edit') { |
||
78 | $taskInfo['countInARun'] = $task->countInARun; |
||
79 | } else { |
||
80 | $taskInfo['countInARun'] = $task->countInARun; |
||
81 | } |
||
82 | } |
||
83 | |||
84 | // input for sleepTime |
||
85 | $fieldId = 'task_sleepTime'; |
||
86 | $fieldCode = '<input type="text" name="tx_scheduler[sleepTime]" id="' . $fieldId . '" value="' . htmlentities($taskInfo['sleepTime']) . '" class="form-control" />'; |
||
87 | $additionalFields[$fieldId] = [ |
||
88 | 'code' => $fieldCode, |
||
89 | 'label' => 'LLL:EXT:crawler/Resources/Private/Language/Backend.xlf:crawler_im.sleepTime' |
||
90 | ]; |
||
91 | // input for sleepAfterFinish |
||
92 | $fieldId = 'task_sleepAfterFinish'; |
||
93 | $fieldCode = '<input type="text" name="tx_scheduler[sleepAfterFinish]" id="' . $fieldId . '" value="' . htmlentities($taskInfo['sleepAfterFinish']) . '" class="form-control" />'; |
||
94 | $additionalFields[$fieldId] = [ |
||
95 | 'code' => $fieldCode, |
||
96 | 'label' => 'LLL:EXT:crawler/Resources/Private/Language/Backend.xlf:crawler_im.sleepAfterFinish' |
||
97 | ]; |
||
98 | // input for countInARun |
||
99 | $fieldId = 'task_countInARun'; |
||
100 | $fieldCode = '<input type="text" name="tx_scheduler[countInARun]" id="' . $fieldId . '" value="' . htmlentities($taskInfo['countInARun']) . '" class="form-control" />'; |
||
101 | $additionalFields[$fieldId] = [ |
||
102 | 'code' => $fieldCode, |
||
103 | 'label' => 'LLL:EXT:crawler/Resources/Private/Language/Backend.xlf:crawler_im.countInARun' |
||
104 | ]; |
||
105 | |||
106 | return $additionalFields; |
||
107 | } |
||
153 |
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