@@ -39,6 +39,6 @@ |
||
39 | 39 | { |
40 | 40 | $bits = $this->persister->getBulk($this->getBits($value)); |
41 | 41 | |
42 | - return !in_array(0, $bits); |
|
42 | + return ! in_array(0, $bits); |
|
43 | 43 | } |
44 | 44 | } |
@@ -141,8 +141,8 @@ |
||
141 | 141 | */ |
142 | 142 | private function offsetToByte(int $offset): int |
143 | 143 | { |
144 | - $this->assertOffset($offset); |
|
145 | - $byte = $offset / 2; |
|
144 | + $this->assertOffset($offset); |
|
145 | + $byte = $offset / 2; |
|
146 | 146 | |
147 | 147 | if ($this->size <= $byte) { |
148 | 148 | $this->bytes .= str_repeat(chr(0), $byte - $this->size + self::DEFAULT_BYTE_SIZE); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | if ($low > self::MAX_AMOUNT_PER_BIT || $high > self::MAX_AMOUNT_PER_BIT) { |
76 | - throw new MaxLimitPerBitReached('max amount per bit should not be higher than ' . self::MAX_AMOUNT_PER_BIT); |
|
76 | + throw new MaxLimitPerBitReached('max amount per bit should not be higher than '.self::MAX_AMOUNT_PER_BIT); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | $this->bytes[$offsetByte] = chr($low | ($high << 4)); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | if ($low > self::MAX_AMOUNT_PER_BIT || $high > self::MAX_AMOUNT_PER_BIT) { |
120 | - throw new MaxLimitPerBitReached('max amount per bit should not be higher than ' . self::MAX_AMOUNT_PER_BIT); |
|
120 | + throw new MaxLimitPerBitReached('max amount per bit should not be higher than '.self::MAX_AMOUNT_PER_BIT); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | $this->bytes[$offsetByte] = chr(max([$low, 0]) | (max([$high, 0]) << 4)); |
@@ -12,10 +12,10 @@ |
||
12 | 12 | */ |
13 | 13 | public function generate(string $value): string |
14 | 14 | { |
15 | - $value = array_values(unpack('C*',(string) $value)); |
|
15 | + $value = array_values(unpack('C*', (string) $value)); |
|
16 | 16 | $klen = count($value); |
17 | 17 | $h1 = 0; |
18 | - for ($i=0,$bytes=$klen-($remainder=$klen&3) ; $i<$bytes ; ) { |
|
18 | + for ($i = 0, $bytes = $klen - ($remainder = $klen & 3); $i < $bytes;) { |
|
19 | 19 | $k1 = $value[$i] |
20 | 20 | | ($value[++$i] << 8) |
21 | 21 | | ($value[++$i] << 16) |
@@ -103,6 +103,6 @@ |
||
103 | 103 | { |
104 | 104 | $bits = $this->persister->getBulk($this->getBits($value)); |
105 | 105 | |
106 | - return !in_array(0, $bits); |
|
106 | + return ! in_array(0, $bits); |
|
107 | 107 | } |
108 | 108 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | |
45 | 45 | for ($i = 0; $i <= $bloomFilterCount; ++$i) { |
46 | 46 | |
47 | - $result = !in_array( |
|
47 | + $result = ! in_array( |
|
48 | 48 | 0, |
49 | 49 | $this->persister->getBulk(array_map( |
50 | 50 | function($bit) use ($i) { |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | |
208 | 208 | protected function assertInit() |
209 | 209 | { |
210 | - if (!isset($this->setSize) || !isset($this->falsePositiveProbability)) { |
|
211 | - throw new NotInitialized(static::class . ' should be initialized'); |
|
210 | + if ( ! isset($this->setSize) || ! isset($this->falsePositiveProbability)) { |
|
211 | + throw new NotInitialized(static::class.' should be initialized'); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | |
@@ -275,6 +275,6 @@ discard block |
||
275 | 275 | */ |
276 | 276 | private function hash(string $value, int $index) |
277 | 277 | { |
278 | - return $this->hash->generate($value . $index) % $this->bitSize; |
|
278 | + return $this->hash->generate($value.$index) % $this->bitSize; |
|
279 | 279 | } |
280 | 280 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @param Filter $bloomFilter |
40 | 40 | * @param CacheProvider[] ...$cacheProviders |
41 | 41 | */ |
42 | - public function __construct(Filter $bloomFilter , CacheProvider ...$cacheProviders) |
|
42 | + public function __construct(Filter $bloomFilter, CacheProvider ...$cacheProviders) |
|
43 | 43 | { |
44 | 44 | parent::__construct($cacheProviders); |
45 | 45 | $this->bloomFilter = $bloomFilter; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | protected function doFetch($id) |
52 | 52 | { |
53 | - if (!$this->bloomFilter->has($id)) { |
|
53 | + if ( ! $this->bloomFilter->has($id)) { |
|
54 | 54 | return false; |
55 | 55 | } |
56 | 56 |