Completed
Push — master ( 2ec668...ccc107 )
by Kevin
08:01 queued 04:33
created
src/Helpers/NumericColumnLimitHelper.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function __construct(Column $column)
36 36
     {
37
-        if (!\in_array($column->getType()->getName(), self::$handledNumberTypes, true)){
37
+        if (!\in_array($column->getType()->getName(), self::$handledNumberTypes, true)) {
38 38
             throw new UnsupportedDataTypeException('Unsupported column type : ' .
39 39
                 $column->getType()->getName() . 'only ' .
40 40
                 implode("', '", self::$handledNumberTypes) . ' types are supported.'
@@ -50,15 +50,15 @@  discard block
 block discarded – undo
50 50
     public function getMinNumericValue()
51 51
     {
52 52
         $precisionValue = $this->getAbsValueByLengthPrecision($this->column);
53
-        switch ($this->column->getType()->getName()){
53
+        switch ($this->column->getType()->getName()) {
54 54
             case Type::BIGINT:
55 55
                 return $this->column->getUnsigned() ? 0 : bcmul('-1', bcpow('2', '63'));
56 56
                 break;
57 57
             case Type::INTEGER:
58
-                return $this->column->getUnsigned() ? 0 : max(-1 * $precisionValue, bcmul('-1' , bcpow('2', '31')));
58
+                return $this->column->getUnsigned() ? 0 : max(-1 * $precisionValue, bcmul('-1', bcpow('2', '31')));
59 59
                 break;
60 60
             case Type::SMALLINT:
61
-                return $this->column->getUnsigned() ? 0 : bcmul('-1' , bcpow('2', '15'));
61
+                return $this->column->getUnsigned() ? 0 : bcmul('-1', bcpow('2', '15'));
62 62
                 break;
63 63
             case Type::DECIMAL:
64 64
                 return $this->column->getUnsigned() ? 0 : -1 * $precisionValue;
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
     public function getMaxNumericValue()
77 77
     {
78 78
         $precisionValue = $this->getAbsValueByLengthPrecision($this->column);
79
-        switch ($this->column->getType()->getName()){
79
+        switch ($this->column->getType()->getName()) {
80 80
             case Type::BIGINT:
81
-                return $this->column->getUnsigned() ? bcsub(bcpow('2', '64'), 1) : bcsub(bcpow('2', '63') , '1');
81
+                return $this->column->getUnsigned() ? bcsub(bcpow('2', '64'), 1) : bcsub(bcpow('2', '63'), '1');
82 82
             case Type::INTEGER:
83
-                return $this->column->getUnsigned() ? bcsub(bcpow('2', '32'), 1) : min($precisionValue, bcsub( bcpow('2', '31') , '1'));
83
+                return $this->column->getUnsigned() ? bcsub(bcpow('2', '32'), 1) : min($precisionValue, bcsub(bcpow('2', '31'), '1'));
84 84
             case Type::SMALLINT:
85
-                return $this->column->getUnsigned() ? bcsub(bcpow('2', '16'), 1) : bcsub( bcpow('2', '15') , '1');
85
+                return $this->column->getUnsigned() ? bcsub(bcpow('2', '16'), 1) : bcsub(bcpow('2', '15'), '1');
86 86
             case Type::DECIMAL:
87 87
                 return $this->column->getUnsigned() ? 0 : $precisionValue;
88 88
             case Type::FLOAT:
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      */
97 97
     private function getAbsValueByLengthPrecision(Column $column)
98 98
     {
99
-        switch ($column->getType()->getName()){
99
+        switch ($column->getType()->getName()) {
100 100
             case Type::DECIMAL:
101 101
                 $str = str_repeat('9', $column->getScale());
102 102
                 return (double) substr_replace($str, '.', $column->getScale() - $column->getPrecision(), 0);
Please login to merge, or discard this patch.