Completed
Push — master ( d53ccf...d60caa )
by Ankit
03:18
created
src/Session.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -10,6 +10,9 @@
 block discarded – undo
10 10
         $_SESSION[$key] = $value;
11 11
     }
12 12
 
13
+    /**
14
+     * @param string $key
15
+     */
13 16
     public static function get($key){
14 17
         return (isset($_SESSION[$key]) ? $_SESSION[$key] : null);
15 18
     }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@
 block discarded – undo
6 6
 class Session
7 7
 {
8 8
 
9
-    public static function put($key, $value){
9
+    public static function put($key, $value) {
10 10
         $_SESSION[$key] = $value;
11 11
     }
12 12
 
13
-    public static function get($key){
13
+    public static function get($key) {
14 14
         return (isset($_SESSION[$key]) ? $_SESSION[$key] : null);
15 15
     }
16 16
 
17
-    public static function forget($key){
17
+    public static function forget($key) {
18 18
         unset($_SESSION[$key]);
19 19
     }
20 20
 
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once (__DIR__ . '/vendor/autoload.php');
3
+require_once (__DIR__.'/vendor/autoload.php');
4 4
 use ChatApp\Session;
5 5
 use Dotenv\Dotenv;
6 6
 $dotenv = new Dotenv(__DIR__);
7 7
 $dotenv->load();
8 8
 
9 9
 // die("Hello");
10
-if(Session::get('start') != null)
10
+if (Session::get('start') != null)
11 11
 {
12 12
     header("Location:".getenv('APP_URL')."/views/account.php");
13 13
 }
Please login to merge, or discard this patch.
src/Compose.php 1 patch
Spacing   +5 added lines, -5 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\Session;
6 6
 use Dotenv\Dotenv;
7 7
 $dotenv = new Dotenv(dirname(__DIR__));
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
         $userId = $msg->userId;
34 34
         $suggestion = $msg->value;
35 35
         $suggestion = trim($suggestion);
36
-        if(!empty($userId) && !empty($suggestion))
36
+        if (!empty($userId) && !empty($suggestion))
37 37
         {
38 38
             $query = "SELECT * FROM login where login_id != '$userId' and name like '$suggestion%' ORDER BY name DESC";
39
-            if($result = $this->connect->query($query))
39
+            if ($result = $this->connect->query($query))
40 40
             {
41
-                if($result->num_rows > 0)
41
+                if ($result->num_rows > 0)
42 42
                 {
43
-                    while($row = $result->fetch_assoc())
43
+                    while ($row = $result->fetch_assoc())
44 44
                     {
45 45
                         $row["login_id"] = bin2hex(convert_uuencode($row["login_id"]));
46 46
                         $this->array = array_merge($this->array, [$row]);
Please login to merge, or discard this patch.
src/SideBar.php 2 patches
Spacing   +7 added lines, -7 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__));
@@ -32,18 +32,18 @@  discard block
 block discarded – undo
32 32
 
33 33
     public function loadSideBar($userId)
34 34
     {
35
-        if(!empty($userId))
35
+        if (!empty($userId))
36 36
         {
37 37
             $query = "SELECT * FROM total_message WHERE user1='$userId' or user2='$userId'  ORDER BY id DESC";
38
-            if($result = $this->connect->query($query))
38
+            if ($result = $this->connect->query($query))
39 39
             {
40 40
                 if ($result->num_rows > 0)
41 41
                 {
42
-                    while($row = $result->fetch_assoc())
42
+                    while ($row = $result->fetch_assoc())
43 43
                     {
44 44
                         $identifier = $row['identifier'];
45 45
                         $substring = explode(":", $identifier);
46
-                        if($substring[0] != $userId)
46
+                        if ($substring[0] != $userId)
47 47
                         {
48 48
                             $this->data($substring[0], $row);
49 49
                         }
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
     public function data($userId, $row)
65 65
     {
66 66
         $query = "SELECT username, name, login_status, login_id from login where login_id = '$userId'";
67
-        if($result = $this->connect->query($query))
67
+        if ($result = $this->connect->query($query))
68 68
         {
69
-            if($result->num_rows > 0)
69
+            if ($result->num_rows > 0)
70 70
             {
71 71
                 $fetch = $result->fetch_assoc();
72 72
                 $fetch['login_id'] = bin2hex(convert_uuencode($fetch['login_id']));
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,8 +46,7 @@
 block discarded – undo
46 46
                         if($substring[0] != $userId)
47 47
                         {
48 48
                             $this->data($substring[0], $row);
49
-                        }
50
-                        else
49
+                        } else
51 50
                         {
52 51
                             $this->data($substring[1], $row);
53 52
                         }
Please login to merge, or discard this patch.
src/Receiver.php 1 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__) . '/vendor/autoload.php');
4
+require_once (dirname(__DIR__).'/vendor/autoload.php');
5 5
 use ChatApp\User;
6 6
 use ChatApp\Conversation;
7 7
 use Dotenv\Dotenv;
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         $msg = json_encode($msg);
37 37
         $this->messages = json_decode($this->conversation->conversationLoad($msg, $para));
38 38
         // $id1 = json_decode($msg)->details;
39
-        for ($i=1 ; $i < count($this->messages); $i++) {
39
+        for ($i = 1; $i < count($this->messages); $i++) {
40 40
             $this->messages[$i]->start = $id1;
41 41
         }
42 42
         $id2 = bin2hex(convert_uuencode($id2));
Please login to merge, or discard this patch.
src/Time.php 2 patches
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
         return $time;
29 29
     }
Please login to merge, or discard this patch.
Braces   +9 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,14 +16,15 @@
 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);
25
-        else
26
-            $time = substr($time,4,11);
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
+        } else {
26
+                    $time = substr($time,4,11);
27
+        }
27 28
 
28 29
         return $time;
29 30
     }
Please login to merge, or discard this patch.