@@ -101,8 +101,7 @@ discard block |
||
101 | 101 | public function strpos(string $subStr, int $offset = 0, bool $caseSensitive = false) : IntType |
102 | 102 | { |
103 | 103 | $res = ($caseSensitive) ? |
104 | - mb_strpos($this->str, $subStr, $offset, $this->encoding) : |
|
105 | - mb_stripos($this->str, $subStr, $offset, $this->encoding); |
|
104 | + mb_strpos($this->str, $subStr, $offset, $this->encoding) : mb_stripos($this->str, $subStr, $offset, $this->encoding); |
|
106 | 105 | |
107 | 106 | return new IntType($res); |
108 | 107 | } |
@@ -119,8 +118,7 @@ discard block |
||
119 | 118 | public function strrpos(string $subStr, int $offset = 0, bool $caseSensitive = false) : IntType |
120 | 119 | { |
121 | 120 | $res = ($caseSensitive) ? |
122 | - mb_strrpos($this->str, $subStr, $offset, $this->encoding) : |
|
123 | - mb_strripos($this->str, $subStr, $offset, $this->encoding); |
|
121 | + mb_strrpos($this->str, $subStr, $offset, $this->encoding) : mb_strripos($this->str, $subStr, $offset, $this->encoding); |
|
124 | 122 | |
125 | 123 | return new IntType($res); |
126 | 124 | } |
@@ -52,7 +52,7 @@ |
||
52 | 52 | private static function asInt($mixed) : int |
53 | 53 | { |
54 | 54 | return static::asSubType( |
55 | - function ($v) { |
|
55 | + function($v) { |
|
56 | 56 | return intval(round($v)); |
57 | 57 | }, |
58 | 58 | $mixed |
@@ -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 | } |
@@ -98,8 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | self::$collection[$address] = &$pointer; |
101 | - self::$lastAddress = $address; |
|
102 | - ++self::$entriesCount; |
|
101 | + self::$lastAddress = $address;++self::$entriesCount; |
|
103 | 102 | } |
104 | 103 | |
105 | 104 | /** |
@@ -119,8 +118,7 @@ discard block |
||
119 | 118 | } |
120 | 119 | |
121 | 120 | $address = self::createAddress(); |
122 | - self::$collection[$address] = &$pointer; |
|
123 | - ++self::$entriesCount; |
|
121 | + self::$collection[$address] = &$pointer;++self::$entriesCount; |
|
124 | 122 | |
125 | 123 | return $address; |
126 | 124 | } |
@@ -154,8 +152,7 @@ discard block |
||
154 | 152 | return false; |
155 | 153 | } |
156 | 154 | |
157 | - unset(self::$collection[$address]); |
|
158 | - --self::$entriesCount; |
|
155 | + unset(self::$collection[$address]);--self::$entriesCount; |
|
159 | 156 | |
160 | 157 | return true; |
161 | 158 | } |
@@ -45,8 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | return strval( |
48 | - $this->isIntOperation($type, $precision) ? (intval($leftOperand) + intval($rightOperand)) : |
|
49 | - round(floatval($leftOperand) + floatval($rightOperand), $precision, $this->getRoundingStrategy()) |
|
48 | + $this->isIntOperation($type, $precision) ? (intval($leftOperand) + intval($rightOperand)) : round(floatval($leftOperand) + floatval($rightOperand), $precision, $this->getRoundingStrategy()) |
|
50 | 49 | ); |
51 | 50 | } |
52 | 51 | |
@@ -72,8 +71,7 @@ discard block |
||
72 | 71 | } |
73 | 72 | |
74 | 73 | return strval( |
75 | - $this->isIntOperation($type, $precision) ? (intval($leftOperand) - intval($rightOperand)) : |
|
76 | - round($leftOperand - $rightOperand, $precision, $this->getRoundingStrategy()) |
|
74 | + $this->isIntOperation($type, $precision) ? (intval($leftOperand) - intval($rightOperand)) : round($leftOperand - $rightOperand, $precision, $this->getRoundingStrategy()) |
|
77 | 75 | ); |
78 | 76 | } |
79 | 77 | |
@@ -99,8 +97,7 @@ discard block |
||
99 | 97 | } |
100 | 98 | |
101 | 99 | return strval( |
102 | - $this->isIntOperation($type, $precision) ? (intval($leftOperand) * intval($rightOperand)) : |
|
103 | - round($leftOperand * $rightOperand, ($precision ?? 0), $this->getRoundingStrategy()) |
|
100 | + $this->isIntOperation($type, $precision) ? (intval($leftOperand) * intval($rightOperand)) : round($leftOperand * $rightOperand, ($precision ?? 0), $this->getRoundingStrategy()) |
|
104 | 101 | ); |
105 | 102 | } |
106 | 103 | |
@@ -126,8 +123,7 @@ discard block |
||
126 | 123 | } |
127 | 124 | |
128 | 125 | return strval( |
129 | - $this->isIntOperation($type, $precision) ? (intval($leftOperand) / intval($rightOperand)) : |
|
130 | - round($leftOperand / $rightOperand, $precision, $this->getRoundingStrategy()) |
|
126 | + $this->isIntOperation($type, $precision) ? (intval($leftOperand) / intval($rightOperand)) : round($leftOperand / $rightOperand, $precision, $this->getRoundingStrategy()) |
|
131 | 127 | ); |
132 | 128 | } |
133 | 129 | |
@@ -306,7 +302,7 @@ discard block |
||
306 | 302 | return $this->getNonPrecisionResult('gmp_fact', $operand); |
307 | 303 | } |
308 | 304 | |
309 | - $factorial = function (string $num) use (&$factorial) { |
|
305 | + $factorial = function(string $num) use (&$factorial) { |
|
310 | 306 | if ($num < 2) { |
311 | 307 | return 1; |
312 | 308 | } |
@@ -337,7 +333,7 @@ discard block |
||
337 | 333 | return $this->getNonPrecisionResult('gmp_gcd', $leftOperand, $rightOperand); |
338 | 334 | } |
339 | 335 | |
340 | - $gcd = function (string $a, string $b) use (&$gcd) { |
|
336 | + $gcd = function(string $a, string $b) use (&$gcd) { |
|
341 | 337 | return $b > .01 ? $gcd($b, strval(fmod(floatval($a), floatval($b)))) : $a; |
342 | 338 | }; |
343 | 339 | |
@@ -390,7 +386,7 @@ discard block |
||
390 | 386 | } |
391 | 387 | |
392 | 388 | $operand = (intval($operand) + 1); |
393 | - for ($i = $operand;; ++$i) { |
|
389 | + for ($i = $operand; ; ++$i) { |
|
394 | 390 | if ($this->isPrime(strval($i))) { |
395 | 391 | break; |
396 | 392 | } |