@@ -2,8 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Tdn\PhpTypes\Memory; |
| 4 | 4 | |
| 5 | -use Tdn\PhpTypes\Type\BoxedTypeInterface; |
|
| 6 | - |
|
| 7 | 5 | /** |
| 8 | 6 | * Class Memory. |
| 9 | 7 | * |
@@ -100,8 +100,7 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | self::$collection[$address] = &$pointer; |
| 103 | - static::$lastAddress = $address; |
|
| 104 | - ++self::$entriesCount; |
|
| 103 | + static::$lastAddress = $address;++self::$entriesCount; |
|
| 105 | 104 | } |
| 106 | 105 | |
| 107 | 106 | /** |
@@ -121,8 +120,7 @@ discard block |
||
| 121 | 120 | } |
| 122 | 121 | |
| 123 | 122 | $address = self::createAddress(); |
| 124 | - self::$collection[$address] = &$pointer; |
|
| 125 | - ++self::$entriesCount; |
|
| 123 | + self::$collection[$address] = &$pointer;++self::$entriesCount; |
|
| 126 | 124 | |
| 127 | 125 | return $address; |
| 128 | 126 | } |
@@ -156,8 +154,7 @@ discard block |
||
| 156 | 154 | return false; |
| 157 | 155 | } |
| 158 | 156 | |
| 159 | - unset(self::$collection[$address]); |
|
| 160 | - --self::$entriesCount; |
|
| 157 | + unset(self::$collection[$address]);--self::$entriesCount; |
|
| 161 | 158 | |
| 162 | 159 | return true; |
| 163 | 160 | } |
@@ -35,8 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | return strval( |
| 37 | 37 | $type === self::TYPE_INT || ($precision === null || $precision === 0) ? |
| 38 | - (intval($leftOperand) + intval($rightOperand)) : |
|
| 39 | - round(floatval($leftOperand) + floatval($rightOperand), $precision, $this->getRoundingStrategy()) |
|
| 38 | + (intval($leftOperand) + intval($rightOperand)) : round(floatval($leftOperand) + floatval($rightOperand), $precision, $this->getRoundingStrategy()) |
|
| 40 | 39 | ); |
| 41 | 40 | } |
| 42 | 41 | |
@@ -63,8 +62,7 @@ discard block |
||
| 63 | 62 | |
| 64 | 63 | return strval( |
| 65 | 64 | $type === self::TYPE_INT || ($precision === null || $precision === 0) ? |
| 66 | - (intval($leftOperand) - intval($rightOperand)) : |
|
| 67 | - round($leftOperand - $rightOperand, $precision, $this->getRoundingStrategy()) |
|
| 65 | + (intval($leftOperand) - intval($rightOperand)) : round($leftOperand - $rightOperand, $precision, $this->getRoundingStrategy()) |
|
| 68 | 66 | ); |
| 69 | 67 | } |
| 70 | 68 | |
@@ -91,8 +89,7 @@ discard block |
||
| 91 | 89 | |
| 92 | 90 | return strval( |
| 93 | 91 | $type === self::TYPE_INT || ($precision === null || $precision === 0) ? |
| 94 | - (intval($leftOperand) * intval($rightOperand)) : |
|
| 95 | - round($leftOperand * $rightOperand, ($precision ?? 0), $this->getRoundingStrategy()) |
|
| 92 | + (intval($leftOperand) * intval($rightOperand)) : round($leftOperand * $rightOperand, ($precision ?? 0), $this->getRoundingStrategy()) |
|
| 96 | 93 | ); |
| 97 | 94 | } |
| 98 | 95 | |
@@ -119,8 +116,7 @@ discard block |
||
| 119 | 116 | |
| 120 | 117 | return strval( |
| 121 | 118 | $type === self::TYPE_INT || ($precision === null || $precision === 0) ? |
| 122 | - (intval($leftOperand) / intval($rightOperand)) : |
|
| 123 | - round($leftOperand / $rightOperand, $precision, $this->getRoundingStrategy()) |
|
| 119 | + (intval($leftOperand) / intval($rightOperand)) : round($leftOperand / $rightOperand, $precision, $this->getRoundingStrategy()) |
|
| 124 | 120 | ); |
| 125 | 121 | } |
| 126 | 122 | |
@@ -290,7 +286,7 @@ discard block |
||
| 290 | 286 | return $this->getNonPrecisionResult('gmp_fact', $operand); |
| 291 | 287 | } |
| 292 | 288 | |
| 293 | - $factorial = function (string $num) use (&$factorial) { |
|
| 289 | + $factorial = function(string $num) use (&$factorial) { |
|
| 294 | 290 | if ($num < 2) { |
| 295 | 291 | return 1; |
| 296 | 292 | } |
@@ -321,7 +317,7 @@ discard block |
||
| 321 | 317 | return $this->getNonPrecisionResult('gmp_gcd', $leftOperand, $rightOperand); |
| 322 | 318 | } |
| 323 | 319 | |
| 324 | - $gcd = function (string $a, string $b) use (&$gcd) { |
|
| 320 | + $gcd = function(string $a, string $b) use (&$gcd) { |
|
| 325 | 321 | return $b > .01 ? $gcd($b, strval(fmod(floatval($a), floatval($b)))) : $a; |
| 326 | 322 | }; |
| 327 | 323 | |
@@ -372,7 +368,7 @@ discard block |
||
| 372 | 368 | } |
| 373 | 369 | |
| 374 | 370 | $operand = (intval($operand) + 1); |
| 375 | - for ($i = $operand;; ++$i) { |
|
| 371 | + for ($i = $operand; ; ++$i) { |
|
| 376 | 372 | if ($this->isPrime(strval($i))) { |
| 377 | 373 | break; |
| 378 | 374 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @return string|array |
| 31 | 31 | */ |
| 32 | - public function __invoke(int $toType = Type::ARRAY) |
|
| 32 | + public function __invoke(int $toType = Type::array) |
|
| 33 | 33 | { |
| 34 | 34 | if ($toType === Type::STRING) { |
| 35 | 35 | return (StringType::valueOf($this->toArray()))(Type::STRING); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | return $this->count(); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if ($toType !== Type::ARRAY) { |
|
| 42 | + if ($toType !== Type::array) { |
|
| 43 | 43 | throw new InvalidTransformationException(static::class, $this->getTranslatedType($toType)); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | const BOOL = 1; |
| 12 | 12 | const INT = 2; |
| 13 | 13 | const FLOAT = 3; |
| 14 | - const ARRAY = 4; |
|
| 14 | + const array = 4; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * @return mixed |
@@ -139,7 +139,7 @@ |
||
| 139 | 139 | Type::BOOL => 'bool', |
| 140 | 140 | Type::INT => 'int', |
| 141 | 141 | Type::FLOAT => 'float', |
| 142 | - Type::ARRAY => 'array', |
|
| 142 | + Type::array => 'array', |
|
| 143 | 143 | ]; |
| 144 | 144 | } |
| 145 | 145 | } |