| Conditions | 11 |
| Paths | 11 |
| Total Lines | 19 |
| 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 |
||
| 50 | public function getMinNumericValue() |
||
| 51 | { |
||
| 52 | $precisionValue = $this->getAbsValueByLengthPrecision($this->column); |
||
| 53 | switch ($this->column->getType()->getName()){ |
||
| 54 | case Type::BIGINT: |
||
| 55 | return $this->column->getUnsigned() ? 0 : bcpow('2', '63'); |
||
| 56 | break; |
||
|
|
|||
| 57 | case Type::INTEGER: |
||
| 58 | return $this->column->getUnsigned() ? 0 : max(-1 * $precisionValue, bcmul('-1' , bcpow('2', '31'))); |
||
| 59 | break; |
||
| 60 | case Type::SMALLINT: |
||
| 61 | return $this->column->getUnsigned() ? 0 : bcmul('-1' , bcpow('2', '15')); |
||
| 62 | break; |
||
| 63 | case Type::DECIMAL: |
||
| 64 | return $this->column->getUnsigned() ? 0 : -1 * $precisionValue; |
||
| 65 | break; |
||
| 66 | case Type::FLOAT: |
||
| 67 | return $this->column->getUnsigned() ? 0 : -1.79 * bcpow('10', '308'); |
||
| 68 | break; |
||
| 69 | } |
||
| 109 | } |
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.