Passed
Push — master ( c93e13...b66278 )
by Mauro
01:42
created
examples/apcu/benchmark.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
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']);
Please login to merge, or discard this patch.
examples/simple-array-with-headers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
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',
Please login to merge, or discard this patch.
examples/memcached/benchmark.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
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'
Please login to merge, or discard this patch.
examples/redis/benchmark.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
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']);
Please login to merge, or discard this patch.
examples/simple-array.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
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',
Please login to merge, or discard this patch.
src/Command/IndexCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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 {
Please login to merge, or discard this patch.
src/InMemoryList/Infrastructure/Persistance/MemcachedRepository.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/InMemoryList/Infrastructure/Persistance/RedisRepository.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,
Please login to merge, or discard this patch.
src/InMemoryList/Infrastructure/Persistance/PdoRepository.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     {
42 42
         $this->pdo = $pdo;
43 43
 
44
-        if($createSchema){
44
+        if ($createSchema) {
45 45
             $this->createListCollectionSchema();
46 46
             $this->createListElementSchema();
47 47
         }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
             'data' => $data,
108 108
         ];
109 109
 
110
-        foreach ($list->getElements() as $uuid => $element){
110
+        foreach ($list->getElements() as $uuid => $element) {
111 111
             /** @var ListElement $element */
112 112
 
113 113
             $sql = 'INSERT INTO `'.self::LIST_ELEMENT_TABLE_NAME.'` (
@@ -141,21 +141,21 @@  discard block
 block discarded – undo
141 141
     private function executeQueriesInATransaction(array $statements)
142 142
     {
143 143
         try {
144
-            $this->pdo->setAttribute(\PDO::ATTR_ERRMODE,\PDO::ERRMODE_EXCEPTION);
144
+            $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
145 145
 
146 146
             // beginTransaction
147 147
             $this->pdo->beginTransaction();
148 148
 
149
-            foreach ($statements as $statement){
150
-                if(isset($statement['sql'])){
149
+            foreach ($statements as $statement) {
150
+                if (isset($statement['sql'])) {
151 151
 
152 152
                     $sql = $statement['sql'];
153 153
                     $data = isset($statement['data']) ? $statement['data'] : [];
154 154
 
155 155
                     $stmt = $this->pdo->prepare($sql);
156 156
                     if (!empty($data)) {
157
-                        foreach ($data as $key => &$value){
158
-                            if(is_array($value)){
157
+                        foreach ($data as $key => &$value) {
158
+                            if (is_array($value)) {
159 159
                                 $value = serialize($value);
160 160
                             }
161 161
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
             // commit
170 170
             $this->pdo->commit();
171
-        } catch(\PDOException $e){
171
+        } catch (\PDOException $e) {
172 172
             $this->pdo->rollBack();
173 173
             throw $e;
174 174
         }
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
             \PDO::FETCH_ASSOC
221 221
         );
222 222
 
223
-        if(count($list) === 0){
223
+        if (count($list) === 0) {
224 224
             return [];
225 225
         }
226 226
 
227
-        foreach ($list as $item){
227
+        foreach ($list as $item) {
228 228
             $items[$item['uuid']] = unserialize($item['body']);
229 229
         }
230 230
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         $stmt->bindParam(':uuid', $listUuid);
262 262
         $stmt->execute();
263 263
 
264
-        if($list = $stmt->fetchAll(\PDO::FETCH_ASSOC)){
264
+        if ($list = $stmt->fetchAll(\PDO::FETCH_ASSOC)) {
265 265
             $headers = $list[0]['headers'];
266 266
 
267 267
             if (SerializeChecker::isSerialized($headers)) {
@@ -292,19 +292,19 @@  discard block
 block discarded – undo
292 292
                 JOIN `'.$lc.'` 
293 293
                 ON `'.$lt.'`.`list` = `'.$lc.'`.`uuid`';
294 294
 
295
-        if($listUuid){
295
+        if ($listUuid) {
296 296
             $sql .= 'WHERE `'.$lc.'`.`uuid` = :list';
297 297
         }
298 298
 
299 299
         $stmt = $this->pdo->prepare($sql);
300
-        if($listUuid){
300
+        if ($listUuid) {
301 301
             $stmt->bindParam(':list', $listUuid);
302 302
         }
303 303
         $stmt->execute();
304 304
 
305 305
         $list = $stmt->fetchAll(\PDO::FETCH_ASSOC);
306 306
 
307
-        foreach ($list as $item){
307
+        foreach ($list as $item) {
308 308
             $index[$item['uuid']] = [
309 309
                 'uuid' => $item['uuid'],
310 310
                 'created_on' => \DateTime::createFromFormat('Y-m-d H:i:s.u', $item['created_at']),
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
             throw new ListElementNotConsistentException('Element '.(string) $elementUuid.' is not consistent with list data.');
394 394
         }
395 395
 
396
-        if(is_array($updatedElementBody) || is_object($updatedElementBody)){
396
+        if (is_array($updatedElementBody) || is_object($updatedElementBody)) {
397 397
             $updatedElementBody = serialize($updatedElementBody);
398 398
         }
399 399
 
Please login to merge, or discard this patch.