Completed
Push — master ( d40969...da46fb )
by Ankit
08:16
created
src/Conversation.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 namespace ChatApp;
4
-require_once (dirname(__DIR__) . '/vendor/autoload.php');
4
+require_once (dirname(__DIR__).'/vendor/autoload.php');
5 5
 use ChatApp\Time;
6 6
 use ChatApp\User;
7 7
 use Dotenv\Dotenv;
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         $msg = json_decode($msg);
38 38
 
39
-        if(!empty($msg))
39
+        if (!empty($msg))
40 40
         {
41 41
             $userId = $msg->userId;
42 42
             $add_load = 0;
@@ -45,25 +45,25 @@  discard block
 block discarded – undo
45 45
 
46 46
             $fetch = $this->obUser->userDetails($username, $para);
47 47
 
48
-            if($fetch != NULL)
48
+            if ($fetch != NULL)
49 49
             {
50 50
                 $login_id = (int)$fetch['login_id'];
51 51
 
52 52
                 // Unique Identifier
53
-                if($login_id > $userId)
53
+                if ($login_id > $userId)
54 54
                     $identifier = $userId.':'.$login_id;
55 55
                 else
56 56
                     $identifier = $login_id.':'.$userId;
57 57
 
58 58
                 $query = "SELECT total_messages from total_message where identifier = '$identifier'";
59
-                if($result = $this->connect->query($query))
59
+                if ($result = $this->connect->query($query))
60 60
                 {
61
-                    if($result->num_rows > 0)
61
+                    if ($result->num_rows > 0)
62 62
                     {
63 63
                         $total = $result->fetch_assoc();
64 64
                         $total = $total['total_messages'];
65
-                        if($total - $load > 0)
66
-                            if($total - $load > 10)
65
+                        if ($total - $load > 0)
66
+                            if ($total - $load > 10)
67 67
                                 $add_load = $load + 10;
68 68
                             else
69 69
                                 $add_load = $total;
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
                 }
72 72
 
73 73
                 $query = "SELECT message, time, sent_by FROM messages WHERE identifier_message_number = '$identifier' ORDER BY id DESC limit ".$load;
74
-                if($result = $this->connect->query($query))
74
+                if ($result = $this->connect->query($query))
75 75
                 {
76
-                    if($result->num_rows > 0)
76
+                    if ($result->num_rows > 0)
77 77
                     {
78
-                        while($row = $result->fetch_assoc())
78
+                        while ($row = $result->fetch_assoc())
79 79
                         {
80 80
                             $row['time'] = $this->obTime->timeConversion($row['time']);
81
-                            $row = array_merge($row,['start' => $userId]);
81
+                            $row = array_merge($row, ['start' => $userId]);
82 82
                             $this->array = array_merge($this->array, [$row]);
83 83
                         }
84 84
 
Please login to merge, or discard this patch.
src/Search.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 namespace ChatApp;
4
-require_once (dirname(__DIR__) . '/vendor/autoload.php');
4
+require_once (dirname(__DIR__).'/vendor/autoload.php');
5 5
 use ChatApp\Time;
6 6
 use Dotenv\Dotenv;
7 7
 $dotenv = new Dotenv(dirname(__DIR__));
@@ -34,23 +34,23 @@  discard block
 block discarded – undo
34 34
         $userId = $suggestion->userId;
35 35
         $suggestion = $suggestion->value;
36 36
         $flag = 0;
37
-        if(!empty($userId) && !empty($suggestion))
37
+        if (!empty($userId) && !empty($suggestion))
38 38
         {
39 39
             $suggestion = trim($suggestion);
40
-            if($suggestion != "")
40
+            if ($suggestion != "")
41 41
             {
42 42
                 $query = "SELECT * FROM login where login_id != '$userId' and name like '$suggestion%' ORDER BY name DESC";
43
-                if($result = $this->connect->query($query))
43
+                if ($result = $this->connect->query($query))
44 44
                 {
45
-                    if($result->num_rows > 0)
45
+                    if ($result->num_rows > 0)
46 46
                     {
47
-                        while($row = $result->fetch_assoc())
47
+                        while ($row = $result->fetch_assoc())
48 48
                         {
49 49
                             $check_id = $row["login_id"];
50 50
                             $query = "SELECT * from total_message where (user1 = '$check_id' and user2 = '$userId') or (user2 = '$check_id' and user1 = '$userId')";
51
-                            if($result1 = $this->connect->query($query))
51
+                            if ($result1 = $this->connect->query($query))
52 52
                             {
53
-                                if($result1->num_rows > 0)
53
+                                if ($result1->num_rows > 0)
54 54
                                 {
55 55
                                     $fetch = $result1->fetch_assoc();
56 56
                                     $fetch['time'] = $this->obTime->timeConversion($fetch['time']);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                         }
63 63
                     }
64 64
                 }
65
-                if($flag != 0)
65
+                if ($flag != 0)
66 66
                 {
67 67
                     $this->array = array_merge([], ["Search" => $this->array]);
68 68
                     return json_encode($this->array);
Please login to merge, or discard this patch.