Test Setup Failed
Push — master ( f3ea8f...027aaa )
by Ankit
02:16
created
src/Chat.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -2,11 +2,9 @@
 block discarded – undo
2 2
 namespace ChatApp;
3 3
 use Ratchet\MessageComponentInterface;
4 4
 use Ratchet\ConnectionInterface;
5
-use ChatApp\Models\Message;
6 5
 use ChatApp\Reply;
7 6
 use ChatApp\Conversation;
8 7
 use ChatApp\Receiver;
9
-use ChatApp\SideBar;
10 8
 use ChatApp\Search;
11 9
 use ChatApp\Compose;
12 10
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
     public function onMessage(ConnectionInterface $from, $msg) {
39 39
         $sessionId = $from->WebSocket->request->getCookies()['PHPSESSID'];
40
-        if($msg == 'OpenChat initiated..!')
40
+        if ($msg == 'OpenChat initiated..!')
41 41
         {
42 42
             @$initial->initial = json_decode($this->onSidebar($from->userId));
43 43
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
                     $client->send(json_encode($result));
99 99
                     $this->online = 1;
100 100
                 }
101
-                elseif($client == $from)
101
+                elseif ($client == $from)
102 102
                 {
103 103
                     @$result->sidebar = json_decode($this->onSidebar($client->userId));
104 104
 
Please login to merge, or discard this patch.
src/Receiver.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace ChatApp;
4 4
 require_once (dirname(__DIR__) . '/database.php');
5 5
 use ChatApp\User;
6
-use ChatApp\Time;
7 6
 use ChatApp\Conversation;
8 7
 /**
9 8
 *
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 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__) . '/database.php');
4
+require_once (dirname(__DIR__).'/database.php');
5 5
 use ChatApp\User;
6 6
 use ChatApp\Time;
7 7
 use ChatApp\Conversation;
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         $name = $this->messages['name'];
32 32
         $this->messages = json_decode($this->conversation->ConversationLoad($msg, True));
33 33
         $id = json_decode($msg)->username;
34
-        for ($i=1 ; $i < count($this->messages); $i++) {
34
+        for ($i = 1; $i < count($this->messages); $i++) {
35 35
             $this->messages[$i]->start = $id;
36 36
         }
37 37
         $this->messages[0]->username = $username;
Please login to merge, or discard this patch.
login.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 session_start();
3
-if(isset($_SESSION['start']))
3
+if (isset($_SESSION['start']))
4 4
 {
5 5
     header("Location: account.php");
6 6
 }
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 		<div class="header">
16 16
 			<a id="brand" href="#">OpenChat</a>
17 17
 			<ul class="nav-right">
18
-				<?php if(isset($_SESSION['start']))
18
+				<?php if (isset($_SESSION['start']))
19 19
 				{
20 20
 				?>
21 21
 				<li><a href="account.php">Account</a></li>
Please login to merge, or discard this patch.
src/Compose.php 1 patch
Spacing   +6 added lines, -6 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__) . '/database.php');
4
+require_once (dirname(__DIR__).'/database.php');
5 5
 
6 6
 /**
7 7
 *
@@ -23,18 +23,18 @@  discard block
 block discarded – undo
23 23
     public function SelectUser($msg)
24 24
     {
25 25
         $msg = $msg->value;
26
-        if(isset($_SESSION['start']) && isset($msg))
26
+        if (isset($_SESSION['start']) && isset($msg))
27 27
         {
28 28
             $id = $_SESSION['start'];
29 29
             $suggestion = trim($msg);
30
-            if($suggestion != "" )
30
+            if ($suggestion != "")
31 31
             {
32 32
                 $query = "SELECT * FROM login where login_id != '$id' and name like '$suggestion%' ORDER BY name DESC";
33
-                if($result = $this->connect->query($query))
33
+                if ($result = $this->connect->query($query))
34 34
                 {
35
-                    if($result->num_rows > 0)
35
+                    if ($result->num_rows > 0)
36 36
                     {
37
-                        while($row = $result->fetch_assoc())
37
+                        while ($row = $result->fetch_assoc())
38 38
                         {
39 39
                             $this->array = array_merge($this->array, [$row]);
40 40
                         }
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
     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
         return $time;
29 29
     }
Please login to merge, or discard this patch.
src/Models/message.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
 class Message extends Model
10 10
 {
11
-    protected $table='message';
11
+    protected $table = 'message';
12 12
 
13 13
     protected $fillable = ['identifier_message_number', 'message', 'sent_by', 'time'];
14 14
 }
Please login to merge, or discard this patch.
src/User.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 
4 4
 namespace ChatApp;
5
-require_once (dirname(__DIR__) . '/database.php');
5
+require_once (dirname(__DIR__).'/database.php');
6 6
 
7 7
 /**
8 8
 * For retreiving User Information
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
 
22 22
     function UserDetails($id, $para)
23 23
     {
24
-        if($para == True)
24
+        if ($para == True)
25 25
             $this->query = "SELECT * from login where login_id = '$id'";
26 26
         else
27 27
             $this->query = "SELECT * from login where username = '$id'";
28 28
         $this->result = $this->connect->query($this->query);
29
-        if($this->result->num_rows > 0)                   // if true
29
+        if ($this->result->num_rows > 0)                   // if true
30 30
         {
31 31
             $this->details = $this->result->fetch_assoc();
32 32
             return $this->details;
Please login to merge, or discard this patch.
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__) . '/database.php');
4
+require_once (dirname(__DIR__).'/database.php');
5 5
 use ChatApp\Time;
6 6
 use ChatApp\User;
7 7
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     {
31 31
 
32 32
         $flag = 1;
33
-        if(isset($_SESSION['start']) && isset($msg))
33
+        if (isset($_SESSION['start']) && isset($msg))
34 34
         {
35 35
             $add_load = 0;
36 36
             $id = $_SESSION['start'];
@@ -40,25 +40,25 @@  discard block
 block discarded – undo
40 40
 
41 41
             $fetch = $this->obUser->UserDetails($username, $para);
42 42
 
43
-            if($fetch != NULL)
43
+            if ($fetch != NULL)
44 44
             {
45 45
                 $login_id = (int)$fetch['login_id'];
46 46
 
47 47
                 // Unique Identifier
48
-                if($login_id > $id)
48
+                if ($login_id > $id)
49 49
                     $identifier = $id.':'.$login_id;
50 50
                 else
51 51
                     $identifier = $login_id.':'.$id;
52 52
 
53 53
                 $query = "SELECT total_messages from total_message where identifier = '$identifier'";
54
-                if($result = $this->connect->query($query))
54
+                if ($result = $this->connect->query($query))
55 55
                 {
56
-                    if($result->num_rows > 0)
56
+                    if ($result->num_rows > 0)
57 57
                     {
58 58
                         $total = $result->fetch_assoc();
59 59
                         $total = $total['total_messages'];
60
-                        if($total - $load > 0)
61
-                            if($total - $load > 10)
60
+                        if ($total - $load > 0)
61
+                            if ($total - $load > 10)
62 62
                                 $add_load = $load + 10;
63 63
                             else
64 64
                                 $add_load = $total;
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
                 }
67 67
 
68 68
                 $query = "SELECT message, time, sent_by FROM messages WHERE identifier_message_number = '$identifier' ORDER BY id DESC limit ".$load;
69
-                if($result = $this->connect->query($query))
69
+                if ($result = $this->connect->query($query))
70 70
                 {
71
-                    if($result->num_rows > 0)
71
+                    if ($result->num_rows > 0)
72 72
                     {
73
-                        while($row = $result->fetch_assoc())
73
+                        while ($row = $result->fetch_assoc())
74 74
                         {
75 75
                             $row['time'] = $this->obTime->TimeConversion($row['time']);
76
-                            $row = array_merge($row,['start' => $id]);
76
+                            $row = array_merge($row, ['start' => $id]);
77 77
                             $this->array = array_merge($this->array, [$row]);
78 78
                         }
79 79
 
Please login to merge, or discard this patch.