Conditions | 10 |
Paths | 5 |
Total Lines | 16 |
Code Lines | 9 |
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 |
||
16 | private function getEditFunctionNames(TableFieldEntity $field, array $values, bool $update): array |
||
17 | { |
||
18 | $names = $values; |
||
19 | foreach ($this->driver->editFunctions() as $key => $functions) { |
||
20 | if (!$key || (!isset($this->utils->input->values['call']) && $update)) { // relative functions |
||
21 | foreach ($functions as $pattern => $value) { |
||
22 | if (!$pattern || preg_match("~$pattern~", $field->type)) { |
||
23 | $names[] = $value; |
||
24 | } |
||
25 | } |
||
26 | } |
||
27 | if ($key && !preg_match('~set|blob|bytea|raw|file|bool~', $field->type)) { |
||
28 | $names[] = 'SQL'; |
||
29 | } |
||
30 | } |
||
31 | return $names; |
||
32 | } |
||
52 |