@@ -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 | } |
@@ -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) |
@@ -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 | |
@@ -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 | } |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | $byte++; |
| 36 | 36 | |
| 37 | 37 | if ($byte > self::MAX_AMOUNT_PER_BIT) { |
| 38 | - throw new MaxLimitPerBitReached('max amount per bit should not be higher than ' . self::MAX_AMOUNT_PER_BIT); |
|
| 38 | + throw new MaxLimitPerBitReached('max amount per bit should not be higher than '.self::MAX_AMOUNT_PER_BIT); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $this->bytes[$offsetByte] = chr($byte); |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | if ($low > self::MAX_AMOUNT_PER_BIT || $high > self::MAX_AMOUNT_PER_BIT) { |
| 45 | - throw new MaxLimitPerBitReached('max amount per bit should not be higher than ' . self::MAX_AMOUNT_PER_BIT); |
|
| 45 | + throw new MaxLimitPerBitReached('max amount per bit should not be higher than '.self::MAX_AMOUNT_PER_BIT); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $this->bytes[$offsetByte] = chr($low | ($high << 4)); |