@@ -28,7 +28,7 @@ |
||
| 28 | 28 | |
| 29 | 29 | $client = new Client('apcu'); |
| 30 | 30 | |
| 31 | -if(!$client->getRepository()->existsListInIndex('range-list')){ |
|
| 31 | +if (!$client->getRepository()->existsListInIndex('range-list')) { |
|
| 32 | 32 | $client->create($array, [ |
| 33 | 33 | 'uuid' => 'range-list', |
| 34 | 34 | 'element-uuid' => 'id']); |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | $client->getRepository()->flush(); |
| 36 | 36 | |
| 37 | 37 | |
| 38 | -if(!$client->getRepository()->existsListInIndex('simple-list-with-h')){ |
|
| 38 | +if (!$client->getRepository()->existsListInIndex('simple-list-with-h')) { |
|
| 39 | 39 | $client->create($simpleArray, [ |
| 40 | 40 | 'uuid' => 'simple-list-with-h', |
| 41 | 41 | 'element-uuid' => 'id', |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | |
| 29 | 29 | $client = new Client('memcached', $config['memcached_parameters']); |
| 30 | 30 | |
| 31 | -if(!$client->getRepository()->existsListInIndex('range-list')){ |
|
| 31 | +if (!$client->getRepository()->existsListInIndex('range-list')) { |
|
| 32 | 32 | $client->create($array, [ |
| 33 | 33 | 'uuid' => 'range-list', |
| 34 | 34 | 'element-uuid' => 'id' |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | |
| 29 | 29 | $client = new Client('redis', $config['redis_parameters']); |
| 30 | 30 | |
| 31 | -if(!$client->getRepository()->existsListInIndex('range-list')){ |
|
| 31 | +if (!$client->getRepository()->existsListInIndex('range-list')) { |
|
| 32 | 32 | $client->create($array, [ |
| 33 | 33 | 'uuid' => 'range-list', |
| 34 | 34 | 'element-uuid' => 'id']); |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | $client = new Client('memcached', $config['memcached_parameters']); |
| 30 | 30 | $client->getRepository()->flush(); |
| 31 | 31 | |
| 32 | -if(!$client->getRepository()->existsListInIndex('simple-list')){ |
|
| 32 | +if (!$client->getRepository()->existsListInIndex('simple-list')) { |
|
| 33 | 33 | $client->create($simpleArray, [ |
| 34 | 34 | 'uuid' => 'simple-list', |
| 35 | 35 | 'element-uuid' => 'id', |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | if ($index && count($index)) { |
| 55 | 55 | ksort($index); |
| 56 | 56 | $table = new Table($output); |
| 57 | - $table->setHeaders(['#', 'List', 'Created on', 'Chunks', 'Chunk size', 'Headers', 'Ttl','Expires on', 'Items']); |
|
| 57 | + $table->setHeaders(['#', 'List', 'Created on', 'Chunks', 'Chunk size', 'Headers', 'Ttl', 'Expires on', 'Items']); |
|
| 58 | 58 | |
| 59 | 59 | $counter = 0; |
| 60 | 60 | foreach ($index as $item) { |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | protected function implodeArrayToAString(array $input) |
| 99 | 99 | { |
| 100 | 100 | $output = implode(', ', array_map( |
| 101 | - function ($v, $k) { |
|
| 101 | + function($v, $k) { |
|
| 102 | 102 | if (is_array($v)) { |
| 103 | 103 | return $k.'[]='.implode('&'.$k.'[]=', $v); |
| 104 | 104 | } else { |
@@ -150,7 +150,7 @@ |
||
| 150 | 150 | { |
| 151 | 151 | $listFirstChunk = $this->memcached->get($listUuid.self::SEPARATOR.self::CHUNK.'-1'); |
| 152 | 152 | |
| 153 | - if(false === $listFirstChunk){ |
|
| 153 | + if (false === $listFirstChunk) { |
|
| 154 | 154 | return false; |
| 155 | 155 | } |
| 156 | 156 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | ]; |
| 71 | 71 | |
| 72 | 72 | // persist all in a transaction |
| 73 | - $this->client->transaction($options, function ($tx) use ($arrayChunks, $list, $ttl, $listUuid, $items, $chunkSize) { |
|
| 73 | + $this->client->transaction($options, function($tx) use ($arrayChunks, $list, $ttl, $listUuid, $items, $chunkSize) { |
|
| 74 | 74 | foreach ($arrayChunks as $chunkNumber => $item) { |
| 75 | 75 | foreach ($item as $key => $element) { |
| 76 | 76 | $listChunkUuid = $listUuid.self::SEPARATOR.self::CHUNK.'-'.($chunkNumber + 1); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | private function getArrayChunksKeys($listUuid, $numberOfChunks) |
| 128 | 128 | { |
| 129 | 129 | $arrayChunksKeys = []; |
| 130 | - for($i=0;$i<$numberOfChunks;$i++){ |
|
| 130 | + for ($i = 0; $i < $numberOfChunks; $i++) { |
|
| 131 | 131 | $arrayChunksKeys[] = $listUuid.self::SEPARATOR.self::CHUNK.'-'.($i + 1); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | ]; |
| 153 | 153 | |
| 154 | 154 | // delete in a transaction |
| 155 | - $this->client->transaction($options, function ($tx) use ($listUuid, $numberOfChunks, $chunkSize, $elementUuid) { |
|
| 155 | + $this->client->transaction($options, function($tx) use ($listUuid, $numberOfChunks, $chunkSize, $elementUuid) { |
|
| 156 | 156 | for ($i = 1; $i <= $numberOfChunks; ++$i) { |
| 157 | 157 | $chunkNumber = $listUuid.self::SEPARATOR.self::CHUNK.'-'.$i; |
| 158 | 158 | $chunk = $this->client->hgetall($chunkNumber); |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | ]; |
| 314 | 314 | |
| 315 | 315 | // persist in a transaction |
| 316 | - $this->client->transaction($options, function ($tx) use ($chunkNumber, $numberOfChunks, $chunkSize, $listUuid, $elementUuid, $body) { |
|
| 316 | + $this->client->transaction($options, function($tx) use ($chunkNumber, $numberOfChunks, $chunkSize, $listUuid, $elementUuid, $body) { |
|
| 317 | 317 | if (($chunkSize - count($tx->hgetall($chunkNumber))) === 0) { |
| 318 | 318 | ++$numberOfChunks; |
| 319 | 319 | $chunkNumber = $listUuid.self::SEPARATOR.self::CHUNK.'-'.$numberOfChunks; |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | ]; |
| 371 | 371 | |
| 372 | 372 | // persist in a transaction |
| 373 | - $this->client->transaction($options, function ($tx) use ($numberOfChunks, $listUuid, $elementUuid, $data) { |
|
| 373 | + $this->client->transaction($options, function($tx) use ($numberOfChunks, $listUuid, $elementUuid, $data) { |
|
| 374 | 374 | for ($i = 1; $i <= $numberOfChunks; ++$i) { |
| 375 | 375 | $chunkNumber = $listUuid.self::SEPARATOR.self::CHUNK.'-'.$i; |
| 376 | 376 | $chunk = $this->client->hgetall($chunkNumber); |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | ]; |
| 429 | 429 | |
| 430 | 430 | // persist in a transaction |
| 431 | - $this->client->transaction($options, function ($tx) use ($numberOfChunks, $listUuid, $ttl) { |
|
| 431 | + $this->client->transaction($options, function($tx) use ($numberOfChunks, $listUuid, $ttl) { |
|
| 432 | 432 | for ($i = 1; $i <= $numberOfChunks; ++$i) { |
| 433 | 433 | $tx->expire( |
| 434 | 434 | (string) $listUuid.self::SEPARATOR.self::CHUNK.'-'.$i, |