| Conditions | 11 |
| Paths | 11 |
| Total Lines | 19 |
| Code Lines | 17 |
| 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 |
||
| 49 | public function getMinNumericValue() |
||
| 50 | { |
||
| 51 | $precisionValue = $this->getAbsValueByLengthPrecision($this->column); |
||
| 52 | switch ($this->column->getType()->getName()) { |
||
| 53 | case Type::BIGINT: |
||
| 54 | return $this->column->getUnsigned() ? 0 : bcmul('-1', bcpow('2', '63')); |
||
| 55 | break; |
||
|
|
|||
| 56 | case Type::INTEGER: |
||
| 57 | return $this->column->getUnsigned() ? 0 : max(-1 * $precisionValue, bcmul('-1', bcpow('2', '31'))); |
||
| 58 | break; |
||
| 59 | case Type::SMALLINT: |
||
| 60 | return $this->column->getUnsigned() ? 0 : bcmul('-1', bcpow('2', '15')); |
||
| 61 | break; |
||
| 62 | case Type::DECIMAL: |
||
| 63 | return $this->column->getUnsigned() ? 0 : -1 * $precisionValue; |
||
| 64 | break; |
||
| 65 | case Type::FLOAT: |
||
| 66 | return $this->column->getUnsigned() ? 0 : -8.95e307; |
||
| 67 | break; |
||
| 68 | } |
||
| 108 |
The
breakstatement is not necessary if it is preceded for example by areturnstatement:If you would like to keep this construct to be consistent with other
casestatements, you can safely mark this issue as a false-positive.