From dfdc4610d61f9720b17daff2f760192582253edb Mon Sep 17 00:00:00 2001 From: Jean Paul Galea Date: Wed, 15 Jul 2015 17:01:51 +0200 Subject: [PATCH] Refactor. - make it easier to follow what is happenining in queue(). --- ykval-synclib.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/ykval-synclib.php b/ykval-synclib.php index 061fe76..a60cb01 100644 --- a/ykval-synclib.php +++ b/ykval-synclib.php @@ -133,22 +133,27 @@ class SyncLib public function queue($otpParams, $localParams) { - - $info=$this->createInfoString($otpParams, $localParams); + $info = $this->createInfoString($otpParams, $localParams); $this->otpParams = $otpParams; $this->localParams = $localParams; $queued=time(); $res=True; - foreach ($this->syncServers as $server) { - if(! $this->db->save('queue', array('queued'=>$queued, - 'modified'=>$otpParams['modified'], - 'otp'=>$otpParams['otp'], - 'server'=>$server, - 'server_nonce'=>$this->server_nonce, - 'info'=>$info))) $res=False; + foreach ($this->syncServers as $server) { + $arr = array( + 'queued' => $queued, + 'modified' => $otpParams['modified'], + 'otp' => $otpParams['otp'], + 'server' => $server, + 'server_nonce' => $this->server_nonce, + 'info' => $info + ); + + if (! $this->db->save('queue', $arr)) + $res=False; } + return $res; }