| Conditions | 10 |
| Paths | 512 |
| Total Lines | 13 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 110 |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 28 | public function fromMySqlDescription($mySqlDescription) { |
||
| 29 | $this->Field = isset($mySqlDescription['Field']) ? $mySqlDescription['Field'] : null; |
||
| 30 | $this->Type = isset($mySqlDescription['Type']) ? $mySqlDescription['Type'] : null; |
||
| 31 | $this->Collation = isset($mySqlDescription['Collation']) ? $mySqlDescription['Collation'] : null; |
||
| 32 | $this->Null = isset($mySqlDescription['Null']) ? $mySqlDescription['Null'] : null; |
||
| 33 | $this->Key = isset($mySqlDescription['Key']) ? $mySqlDescription['Key'] : null; |
||
| 34 | $this->Default = isset($mySqlDescription['Default']) ? $mySqlDescription['Default'] : null; |
||
| 35 | $this->Extra = isset($mySqlDescription['Extra']) ? $mySqlDescription['Extra'] : null; |
||
| 36 | $this->Privileges = isset($mySqlDescription['Privileges']) ? $mySqlDescription['Privileges'] : null; |
||
| 37 | $this->Comment = isset($mySqlDescription['Comment']) ? $mySqlDescription['Comment'] : null; |
||
| 38 | |||
| 39 | return $this; |
||
| 40 | } |
||
| 41 | |||
| 43 |