| 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 |
||
| 91 | private function systemFieldType() |
||
| 92 | { |
||
| 93 | switch ($this->systemFieldName) { |
||
| 94 | case self::SYSFIELD_ID: |
||
| 95 | return "pk"; |
||
| 96 | break; |
||
| 97 | case self::SYSFIELD_SEED: |
||
| 98 | return "string(31)"; |
||
| 99 | break; |
||
| 100 | case self::SYSFIELD_STARTLANGUAGE: |
||
| 101 | return "string(20) NOT NULL"; |
||
| 102 | break; |
||
| 103 | case self::SYSFIELD_STARTDATE: |
||
| 104 | case self::SYSFIELD_DATESTAMP: |
||
| 105 | return "datetime NOT NULL"; |
||
| 106 | break; |
||
| 107 | case self::SYSFIELD_SUBMITDATE: |
||
| 108 | return "datetime"; |
||
| 109 | break; |
||
| 110 | case self::SYSFIELD_LASTPAGE: |
||
| 111 | return "integer"; |
||
| 112 | break; |
||
| 113 | case self::SYSFIELD_TOKEN: |
||
| 114 | return "string(36) " . $this->tokenFieldCollation; |
||
| 115 | break; |
||
| 116 | case self::SYSFIELD_REFURL: |
||
| 117 | return "text"; |
||
| 118 | break; |
||
| 119 | case self::SYSFIELD_IP_ADDRESS: |
||
| 120 | return "string(45)"; |
||
| 121 | break; |
||
| 122 | default: |
||
| 123 | throw new \Exception("Undefined system column {$this->systemFieldName}"); |
||
| 124 | } |
||
| 168 | } |