Conditions | 11 |
Paths | 11 |
Total Lines | 33 |
Code Lines | 31 |
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 |
||
101 | private function systemFieldType() |
||
102 | { |
||
103 | switch ($this->systemFieldName) { |
||
104 | case self::SYSFIELD_ID: |
||
105 | return "pk"; |
||
106 | break; |
||
107 | case self::SYSFIELD_SEED: |
||
108 | return "string(31)"; |
||
109 | break; |
||
110 | case self::SYSFIELD_STARTLANGUAGE: |
||
111 | return "string(31) string(20) NOT NULL"; |
||
112 | break; |
||
113 | case self::SYSFIELD_STARTDATE: |
||
114 | case self::SYSFIELD_DATESTAMP: |
||
115 | return "datetime NOT NULL"; |
||
116 | break; |
||
117 | case self::SYSFIELD_SUBMITDATE: |
||
118 | return "datetime"; |
||
119 | break; |
||
120 | case self::SYSFIELD_LASTPAGE: |
||
121 | return "integer"; |
||
122 | break; |
||
123 | case self::SYSFIELD_TOKEN: |
||
124 | return "string(36) " . $this->tokenFieldCollation; |
||
125 | break; |
||
126 | case self::SYSFIELD_REFURL: |
||
127 | return "text"; |
||
128 | break; |
||
129 | case self::SYSFIELD_IP_ADDRESS: |
||
130 | return "string(45)"; |
||
131 | break; |
||
132 | default: |
||
133 | throw new \Exception("Undefined system column {$this->systemFieldName}"); |
||
134 | } |
||
171 | } |