| Conditions | 10 |
| Paths | 272 |
| Total Lines | 40 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
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 |
||
| 116 | public function toInt($revision) |
||
| 117 | { |
||
| 118 | $flags = 0; |
||
| 119 | |||
| 120 | if ($this->mayPrint) { |
||
| 121 | $flags |= (1 << 2); |
||
| 122 | } |
||
| 123 | |||
| 124 | if ($this->mayModify) { |
||
| 125 | $flags |= (1 << 3); |
||
| 126 | } |
||
| 127 | |||
| 128 | if ($this->mayCopy) { |
||
| 129 | $flags |= (1 << 4); |
||
| 130 | } |
||
| 131 | |||
| 132 | if ($this->mayAnnotate) { |
||
| 133 | $flags |= (1 << 5); |
||
| 134 | } |
||
| 135 | |||
| 136 | if ($revision >= 3) { |
||
| 137 | if ($this->mayFillInForms) { |
||
| 138 | $flags |= (1 << 8); |
||
| 139 | } |
||
| 140 | |||
| 141 | if ($this->mayExtractForAccessibility) { |
||
| 142 | $flags |= (1 << 9); |
||
| 143 | } |
||
| 144 | |||
| 145 | if ($this->mayAssemble) { |
||
| 146 | $flags |= (1 << 10); |
||
| 147 | } |
||
| 148 | |||
| 149 | if ($this->mayPrintHighResolution) { |
||
| 150 | $flags |= (1 << 11); |
||
| 151 | } |
||
| 152 | } |
||
| 153 | |||
| 154 | return $flags; |
||
| 155 | } |
||
| 156 | } |
||
| 157 |