@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require (dirname(__DIR__) . '/vendor/autoload.php'); |
|
| 3 | +require (dirname(__DIR__).'/vendor/autoload.php'); |
|
| 4 | 4 | use ChatApp\Login; |
| 5 | 5 | |
| 6 | -if(isset($_POST['q'])) |
|
| 6 | +if (isset($_POST['q'])) |
|
| 7 | 7 | { |
| 8 | 8 | $loginField = json_decode($_POST['q']); |
| 9 | 9 | $login = $loginField->login; |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | 'passLogin' => $password |
| 15 | 15 | ); |
| 16 | 16 | $result = $obLogin->authLogin($data); |
| 17 | - if(isset($result)) |
|
| 17 | + if (isset($result)) |
|
| 18 | 18 | echo $result; |
| 19 | 19 | else |
| 20 | 20 | echo json_encode([]); |
@@ -1,12 +1,12 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once (dirname(__DIR__) . '/vendor/autoload.php'); |
|
| 3 | +require_once (dirname(__DIR__).'/vendor/autoload.php'); |
|
| 4 | 4 | use ChatApp\Session; |
| 5 | 5 | use Dotenv\Dotenv; |
| 6 | 6 | $dotenv = new Dotenv(dirname(__DIR__)); |
| 7 | 7 | $dotenv->load(); |
| 8 | 8 | |
| 9 | -if(Session::get('start') != null && empty($_GET['user'])) |
|
| 9 | +if (Session::get('start') != null && empty($_GET['user'])) |
|
| 10 | 10 | { |
| 11 | 11 | |
| 12 | 12 | ?> |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | <?php |
| 176 | 176 | } |
| 177 | -else{ |
|
| 178 | - header('Location:'. getenv('APP_URL')."/index.php"); |
|
| 177 | +else { |
|
| 178 | + header('Location:'.getenv('APP_URL')."/index.php"); |
|
| 179 | 179 | } |
| 180 | 180 | ?> |
@@ -1,13 +1,13 @@ |
||
| 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 | } |
@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require (dirname(__DIR__) . '/vendor/autoload.php'); |
|
| 3 | +require (dirname(__DIR__).'/vendor/autoload.php'); |
|
| 4 | 4 | use ChatApp\Register; |
| 5 | 5 | |
| 6 | -if(isset($_POST['q'])) |
|
| 6 | +if (isset($_POST['q'])) |
|
| 7 | 7 | { |
| 8 | 8 | $registerField = json_decode($_POST['q']); |
| 9 | 9 | $name = $registerField->name; |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | 'mob' => $mob |
| 21 | 21 | ); |
| 22 | 22 | $result = $obRegister->authRegister($data); |
| 23 | - if(isset($result)) |
|
| 23 | + if (isset($result)) |
|
| 24 | 24 | echo $result; |
| 25 | 25 | else |
| 26 | 26 | echo json_encode([]); |
@@ -190,12 +190,12 @@ discard block |
||
| 190 | 190 | "passLogin" => 'testing' |
| 191 | 191 | ] |
| 192 | 192 | ); |
| 193 | - $outputEmail = (array) json_decode($outputEmail); |
|
| 193 | + $outputEmail = (array)json_decode($outputEmail); |
|
| 194 | 194 | $this->assertEquals($expectedOutput, $outputEmail); |
| 195 | 195 | $currentId = Session::get('start'); |
| 196 | 196 | Session::forget('start'); |
| 197 | 197 | |
| 198 | - $msg =(object) [ |
|
| 198 | + $msg = (object)[ |
|
| 199 | 199 | "name" => $userId, |
| 200 | 200 | "reply" => "Hello World", |
| 201 | 201 | "userId" => $currentId |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $output = $obReply->replyTo($msg); |
| 206 | 206 | $this->assertEquals("Messages is sent", $output); |
| 207 | 207 | |
| 208 | - $msg =(object) [ |
|
| 208 | + $msg = (object)[ |
|
| 209 | 209 | "name" => $currentId, |
| 210 | 210 | "reply" => "Hello World", |
| 211 | 211 | "userId" => $userId |
@@ -218,14 +218,14 @@ discard block |
||
| 218 | 218 | $output = $obReply->replyTo([]); |
| 219 | 219 | $this->assertEquals("Failed", $output); |
| 220 | 220 | |
| 221 | - $output = $obReply->replyTo((object) [ |
|
| 221 | + $output = $obReply->replyTo((object)[ |
|
| 222 | 222 | "name" => -1, |
| 223 | 223 | "reply" => "Hello World", |
| 224 | 224 | "userId" => $currentId |
| 225 | 225 | ]); |
| 226 | 226 | $this->assertEquals("Invalid Authentication", $output); |
| 227 | 227 | |
| 228 | - $output = $obReply->replyTo((object) [ |
|
| 228 | + $output = $obReply->replyTo((object)[ |
|
| 229 | 229 | "name" => $userId, |
| 230 | 230 | "reply" => "Hello", |
| 231 | 231 | "userId" => $currentId |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | <div class="brief"> |
| 66 | 66 | <h1 id="name">Name: <?php echo $row['name']; ?></h1><br> |
| 67 | 67 | <?php foreach ($row as $key => $value) { |
| 68 | - if ($key =='username' && $value != null) { |
|
| 68 | + if ($key == 'username' && $value != null) { |
|
| 69 | 69 | echo '<p>Username: '.$row["username"].'</p><br>'; |
| 70 | 70 | } |
| 71 | 71 | if ($key == 'email' && $value != null) { |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * |
| 192 | 192 | * @param string $data To store data |
| 193 | 193 | * |
| 194 | - * @return json |
|
| 194 | + * @return string |
|
| 195 | 195 | */ |
| 196 | 196 | public function onSidebar($data) |
| 197 | 197 | { |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | * @param string $data to store data |
| 206 | 206 | * @param boolean $para to store True/False |
| 207 | 207 | * |
| 208 | - * @return json |
|
| 208 | + * @return string |
|
| 209 | 209 | */ |
| 210 | 210 | public function onConversation($data, $para) |
| 211 | 211 | { |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | * @param string $data to store data |
| 220 | 220 | * @param boolean $para to store True/False |
| 221 | 221 | * |
| 222 | - * @return json |
|
| 222 | + * @return string |
|
| 223 | 223 | */ |
| 224 | 224 | public function onReceiver($data, $para) |
| 225 | 225 | { |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * |
| 233 | 233 | * @param string $data to store data |
| 234 | 234 | * |
| 235 | - * @return json |
|
| 235 | + * @return string |
|
| 236 | 236 | */ |
| 237 | 237 | public function onSearch($data) |
| 238 | 238 | { |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | * |
| 246 | 246 | * @param string $data to store data |
| 247 | 247 | * |
| 248 | - * @return json |
|
| 248 | + * @return string |
|
| 249 | 249 | */ |
| 250 | 250 | public function onCompose($data) |
| 251 | 251 | { |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | * |
| 259 | 259 | * @param string $data to store data |
| 260 | 260 | * |
| 261 | - * @return json |
|
| 261 | + * @return string|null |
|
| 262 | 262 | */ |
| 263 | 263 | public function onReply($data) |
| 264 | 264 | { |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | * To Show error due to any problem occured |
| 285 | 285 | * |
| 286 | 286 | * @param ConnectionInterface $conn To store client details |
| 287 | - * @param Exception $e To store exception |
|
| 287 | + * @param \Exception $e To store exception |
|
| 288 | 288 | * |
| 289 | 289 | * @return void |
| 290 | 290 | */ |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | * |
| 64 | 64 | * @param object $msg To store user id and suggestion value |
| 65 | 65 | * |
| 66 | - * @return json |
|
| 66 | + * @return string |
|
| 67 | 67 | */ |
| 68 | 68 | public function selectUser($msg) |
| 69 | 69 | { |
@@ -65,10 +65,10 @@ |
||
| 65 | 65 | /** |
| 66 | 66 | * Fetch data from DB and show to user. |
| 67 | 67 | * |
| 68 | - * @param json $msg To store message |
|
| 68 | + * @param string $msg To store message |
|
| 69 | 69 | * @param boollen $para To store True/False |
| 70 | 70 | * |
| 71 | - * @return json |
|
| 71 | + * @return string |
|
| 72 | 72 | */ |
| 73 | 73 | public function conversationLoad($msg, $para) |
| 74 | 74 | { |