Completed
Push — 2.0 ( 914f97...b41061 )
by Raphaël
05:41 queued 01:50
created
src/ZohoDatabasePusher.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
             $this->logger = $logger;
47 47
         }
48 48
         $this->apiLimitInsertUpdateDelete = $apiLimitInsertUpdateDelete;
49
-        if($apiLimitInsertUpdateDelete === null){
49
+        if ($apiLimitInsertUpdateDelete === null) {
50 50
             $this->apiLimitInsertUpdateDelete = 100;
51 51
         }
52 52
     }
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
         //To optimize your API usage, get maximum 200 records with each request and insert, update or delete maximum 100 records with each request.
130 130
         $offsetTodo = 0;
131 131
         $doneBeans = 0;
132
-        while($doneBeans < $countItems){
133
-            $zohoBeansToSend = array_slice($zohoBeans,$offsetTodo,$this->apiLimitInsertUpdateDelete,true);
132
+        while ($doneBeans < $countItems) {
133
+            $zohoBeansToSend = array_slice($zohoBeans, $offsetTodo, $this->apiLimitInsertUpdateDelete, true);
134 134
             $offsetTodo += $this->apiLimitInsertUpdateDelete;
135 135
             $doneBeans += count($zohoBeansToSend);
136 136
         }
@@ -143,13 +143,13 @@  discard block
 block discarded – undo
143 143
                     // ID not exist we can update the new row with the Zoho ID
144 144
                     $this->connection->beginTransaction();
145 145
                     $this->connection->update($tableName, ['id' => $zohoBean->getZohoId()], ['uid' => $uid]);
146
-                    $this->connection->delete('local_insert', ['table_name'=>$tableName, 'uid' => $uid ]);
146
+                    $this->connection->delete('local_insert', ['table_name'=>$tableName, 'uid' => $uid]);
147 147
                     $this->connection->commit();
148 148
                 } else {
149 149
                     //ID already exist we need to delete the duplicate row.
150 150
                     $this->connection->beginTransaction();
151
-                    $this->connection->delete($tableName, ['uid' => $uid ]);
152
-                    $this->connection->delete('local_insert', ['table_name'=>$tableName, 'uid' => $uid ]);
151
+                    $this->connection->delete($tableName, ['uid' => $uid]);
152
+                    $this->connection->delete('local_insert', ['table_name'=>$tableName, 'uid' => $uid]);
153 153
                     $this->connection->commit();
154 154
                 }
155 155
             }
Please login to merge, or discard this patch.