| Conditions | 10 | 
| Paths | 272 | 
| Total Lines | 40 | 
| Code Lines | 20 | 
| Lines | 0 | 
| Ratio | 0 % | 
| 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 | ||
| 91 | public function toInt($revision) | ||
| 92 |     { | ||
| 93 | $flags = 0; | ||
| 94 | |||
| 95 |         if ($this->mayPrint) { | ||
| 96 | $flags |= 3; | ||
| 97 | } | ||
| 98 | |||
| 99 |         if ($this->mayModify) { | ||
| 100 | $flags |= 4; | ||
| 101 | } | ||
| 102 | |||
| 103 |         if ($this->mayCopy) { | ||
| 104 | $flags |= 5; | ||
| 105 | } | ||
| 106 | |||
| 107 |         if ($this->mayAnnotate) { | ||
| 108 | $flags |= 6; | ||
| 109 | } | ||
| 110 | |||
| 111 |         if ($revision >= 3) { | ||
| 112 |             if ($this->mayFillInForms) { | ||
| 113 | $flags |= 9; | ||
| 114 | } | ||
| 115 | |||
| 116 |             if ($this->mayExtractForAccessibility) { | ||
| 117 | $flags |= 10; | ||
| 118 | } | ||
| 119 | |||
| 120 |             if ($this->mayAssemble) { | ||
| 121 | $flags |= 11; | ||
| 122 | } | ||
| 123 | |||
| 124 |             if ($this->mayPrintHighResolution) { | ||
| 125 | $flags |= 12; | ||
| 126 | } | ||
| 127 | } | ||
| 128 | |||
| 129 | return $flags; | ||
| 130 | } | ||
| 131 | } | ||
| 132 |