| Conditions | 7 |
| Paths | 11 |
| Total Lines | 62 |
| 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 |
||
| 58 | public function getTcaConfiguration($fieldName, $overWriteLabel = false) |
||
| 59 | { |
||
| 60 | $withoutNameSpace = str_replace(self::CLASS_BASE, '', $this->lastClass); |
||
| 61 | |||
| 62 | switch ($withoutNameSpace) { |
||
| 63 | case 'country': |
||
| 64 | $table = 'static_countries'; |
||
| 65 | $itemsProcFunc = 'translateCountriesSelector'; |
||
| 66 | |||
| 67 | break; |
||
| 68 | |||
| 69 | case 'countryzone': |
||
| 70 | $table = 'static_country_zones'; |
||
| 71 | $itemsProcFunc = 'translateCountryZonesSelector'; |
||
| 72 | |||
| 73 | break; |
||
| 74 | |||
| 75 | case 'currency': |
||
| 76 | $table = 'static_currencies'; |
||
| 77 | $itemsProcFunc = 'translateCurrenciesSelector'; |
||
| 78 | |||
| 79 | break; |
||
| 80 | |||
| 81 | case 'language': |
||
| 82 | $table = 'static_languages'; |
||
| 83 | $itemsProcFunc = 'translateLanguagesSelector'; |
||
| 84 | |||
| 85 | break; |
||
| 86 | |||
| 87 | case 'territory': |
||
| 88 | $table = 'static_territories'; |
||
| 89 | $itemsProcFunc = 'translateTerritoriesSelector'; |
||
| 90 | |||
| 91 | break; |
||
| 92 | |||
| 93 | default: |
||
| 94 | return []; |
||
| 95 | } |
||
| 96 | |||
| 97 | return [ |
||
| 98 | 'exclude' => 1, |
||
| 99 | 'label' => $overWriteLabel ? $overWriteLabel : $fieldName, |
||
| 100 | 'config' => [ |
||
| 101 | 'type' => 'select', |
||
| 102 | 'size' => 1, |
||
| 103 | 'minitems' => 0, |
||
| 104 | 'maxitems' => 1, |
||
| 105 | 'items' => [ |
||
| 106 | ['', 0], |
||
| 107 | ], |
||
| 108 | 'itemsProcFunc' => TcaSelectItemsProcessor::class . '->' . $itemsProcFunc, |
||
| 109 | 'foreign_table' => $table, |
||
| 110 | 'wizards' => [ |
||
| 111 | 'suggest' => ['type' => 'suggest', |
||
| 112 | 'default' => [ |
||
| 113 | 'receiverClass' => SuggestReceiver::class, |
||
| 114 | ], |
||
| 115 | ], |
||
| 116 | ], |
||
| 117 | ], |
||
| 118 | ]; |
||
| 119 | } |
||
| 120 | |||
| 131 |