Completed
Push — master ( d60caa...394d07 )
by Ankit
02:48
created
src/Reply.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,16 +36,16 @@  discard block
 block discarded – undo
36 36
                 // geneate specific unique code to store messages
37 37
                 $user1 = $userId;
38 38
                 $user2 = $receiverID;
39
-                $identifier = $userId . ":" . $receiverID;
39
+                $identifier = $userId.":".$receiverID;
40 40
             } else {
41 41
                 $user1 = $receiverID;
42 42
                 $user2 = $userId;
43
-                $identifier = $receiverID . ":" . $userId;
43
+                $identifier = $receiverID.":".$userId;
44 44
             }
45 45
 
46 46
             $reply = addslashes(trim($msg->reply)); // stores the message sent by the user.
47 47
 
48
-            $time = date("D d M Y H:i:s", time() + 16200);  // current time
48
+            $time = date("D d M Y H:i:s", time() + 16200); // current time
49 49
             $time_id = date("YmdHis", time() + 16200); //to sort the array on the basis of time
50 50
 
51 51
             //the sender id must not be equal to current session id
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
                         return $this->updateMessages($query, $identifier, $reply, $userId, $time);
70 70
                     }
71 71
                 }
72
-                return "Invalid Authentication";  // if he is unauthorized echo message is failed
72
+                return "Invalid Authentication"; // if he is unauthorized echo message is failed
73 73
             }
74 74
         }
75 75
         return "Failed";
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             //insert message in db
82 82
             $query = "INSERT into messages values('$identifier', '$reply', '$userId', '$time', null)";
83 83
             if ($this->connect->query($query)) {
84
-                return "Messages is sent";    // if query is executed return true
84
+                return "Messages is sent"; // if query is executed return true
85 85
             }
86 86
             return "Message is failed";
87 87
         }
Please login to merge, or discard this patch.
src/Chat.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
     }
35 35
 
36 36
     public function onMessage(ConnectionInterface $from, $msg) {
37
-        $msg = (object) json_decode($msg);
37
+        $msg = (object)json_decode($msg);
38 38
         if ($msg->type == 'OpenChat initiated..!') {
39
-            $initial = (object) array();
39
+            $initial = (object)array();
40 40
             $initial->initial = json_decode($this->onSidebar($from->userId));
41 41
 
42 42
             if ($initial->initial != null) {
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
             }
53 53
             $from->send(json_encode($initial));
54 54
         } else if ($msg->type == 'Load Sidebar') {
55
-            $sidebar = (object) array();
55
+            $sidebar = (object)array();
56 56
             $sidebar->sidebar = json_decode($this->onSidebar($from->userId));
57 57
             $from->send(json_encode($sidebar));
58 58
         } else if ($msg->type == 'Initiated') {
59 59
             $msg->userId = $from->userId;
60
-            $result = (object) array();
60
+            $result = (object)array();
61 61
             $result->conversation = json_decode($this->onConversation(json_encode($msg), False));
62 62
             $from->send(json_encode($result));
63 63
         } else if ($msg->type == 'Search') {
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
             $getReturn = $this->onReply($msg);
76 76
             echo $getReturn;
77 77
 
78
-            $receiveResult = (object) array();
79
-            $sentResult = (object) array();
78
+            $receiveResult = (object)array();
79
+            $sentResult = (object)array();
80 80
             foreach ($this->clients as $client)
81 81
             {
82 82
                 if ($client->userId == $msg->name) {
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                     );
94 94
 
95 95
                     $client->send(json_encode($receiveResult));
96
-                } else if($client == $from) {
96
+                } else if ($client == $from) {
97 97
                     $sentResult->sidebar = json_decode($this->onSidebar($client->userId));
98 98
 
99 99
                     $sentResult->conversation = json_decode(
Please login to merge, or discard this patch.
src/Time.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@
 block discarded – undo
16 16
     public function timeConversion($time)
17 17
     {
18 18
 
19
-        if (substr($time,4,11) == date("d M Y", time() + 16200)) {
20
-            $time = substr($time,16,5);
21
-        } else if (substr($time,7,8) == date("M Y", time() + 16200) && substr($time, 4,2) - date("d") < 7) {
22
-            $time = substr($time,0,3);
23
-        } else if (substr($time,11,4) == date("Y", time() + 16200)) {
24
-            $time = substr($time,4,6);
19
+        if (substr($time, 4, 11) == date("d M Y", time() + 16200)) {
20
+            $time = substr($time, 16, 5);
21
+        } else if (substr($time, 7, 8) == date("M Y", time() + 16200) && substr($time, 4, 2) - date("d") < 7) {
22
+            $time = substr($time, 0, 3);
23
+        } else if (substr($time, 11, 4) == date("Y", time() + 16200)) {
24
+            $time = substr($time, 4, 6);
25 25
         } else {
26
-            $time = substr($time,4,11);
26
+            $time = substr($time, 4, 11);
27 27
         }
28 28
 
29 29
         return $time;
Please login to merge, or discard this patch.
src/Register.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,12 +76,12 @@
 block discarded – undo
76 76
             $query = "INSERT INTO login VALUES('$userId', '$name', '$email', '$username', '$mob', 0)";
77 77
 
78 78
             if (!$this->connect->query($query)) {
79
-                return json_encode(["Error" => "You are not registered, ".$this->connect->error ]);
79
+                return json_encode(["Error" => "You are not registered, ".$this->connect->error]);
80 80
             }
81 81
 
82 82
             $query = "INSERT INTO profile VALUES('$userId', 'Joined OpenChat', 'Joined OpenChat', '')";
83 83
             if (!$this->connect->query($query)) {
84
-                return json_encode(["Error" => "You are not registered, ".$this->connect->error ]);
84
+                return json_encode(["Error" => "You are not registered, ".$this->connect->error]);
85 85
             }
86 86
 
87 87
             Session::put('start', $userId);
Please login to merge, or discard this patch.