Completed
Push — master ( 39ee05...f34b37 )
by mains
02:48
created
php/DatabaseConnect.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,6 +40,6 @@
 block discarded – undo
40 40
 			 ) DEFAULT CHARSET=utf8";
41 41
   if(!$db->query($query))
42 42
   {
43
-    throw new Exception($db->error($mysqli));
43
+	throw new Exception($db->error($mysqli));
44 44
   }
45 45
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,8 @@
 block discarded – undo
12 12
 
13 13
 }
14 14
 $db = new DatabaseConnect();
15
-if ($db->connect_errno) {
15
+if ($db->connect_errno)
16
+{
16 17
   echo 'Sorry, die Verbindung zu unserem superfetten endgeilen 
17 18
         Server ist hops gegangen. Wegen '.$db -> connect_error;
18 19
 }
Please login to merge, or discard this patch.
php/Requests/GetKarma.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -3,18 +3,18 @@
 block discarded – undo
3 3
 
4 4
 class GetKarma extends AbstractRequest {
5 5
 		
6
-    function getApiEndPoint()
7
-    {
8
-        return '/v2/users/karma';
9
-    }
10
-    function getPayload()
11
-    {
12
-        return array(
13
-        );
14
-    }
15
-    function getMethod()
16
-    {
17
-        return 'GET';
18
-    }
6
+	function getApiEndPoint()
7
+	{
8
+		return '/v2/users/karma';
9
+	}
10
+	function getPayload()
11
+	{
12
+		return array(
13
+		);
14
+	}
15
+	function getMethod()
16
+	{
17
+		return 'GET';
18
+	}
19 19
 }
20 20
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 
4
-class GetKarma extends AbstractRequest {
4
+class GetKarma extends AbstractRequest
5
+{
5 6
 		
6 7
     function getApiEndPoint()
7 8
     {
Please login to merge, or discard this patch.
php/Requests/GetPosts.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -5,20 +5,20 @@  discard block
 block discarded – undo
5 5
 {
6 6
 	public $lastPostId;
7 7
 
8
-    public $url;
8
+	public $url;
9 9
         
10
-    function setUrl ($url)
11
-    {
12
-            $this->url = $url;
13
-    }
10
+	function setUrl ($url)
11
+	{
12
+			$this->url = $url;
13
+	}
14 14
     
15
-    function getUrl ()
16
-    {
17
-        return $this->url;
18
-    }
15
+	function getUrl ()
16
+	{
17
+		return $this->url;
18
+	}
19 19
 		
20
-    function setLastPostId ($lastPostId)
21
-    {
20
+	function setLastPostId ($lastPostId)
21
+	{
22 22
 			$this->lastPostId = $lastPostId;
23 23
 	}
24 24
 	
@@ -27,22 +27,22 @@  discard block
 block discarded – undo
27 27
 		return $this->lastPostId;
28 28
 	}
29 29
     
30
-    function getApiEndPoint()
31
-    {
32
-        $apiEndPoint = $this->getUrl();
33
-        //echo $GLOBALS['lastPostId'];
34
-        if ($this->getLastPostId() != "") {
30
+	function getApiEndPoint()
31
+	{
32
+		$apiEndPoint = $this->getUrl();
33
+		//echo $GLOBALS['lastPostId'];
34
+		if ($this->getLastPostId() != "") {
35 35
 			$apiEndPoint = $this->getUrl() . '/location/?after=' . $this->getLastPostId();
36 36
 		}
37
-        return $apiEndPoint;
38
-    }
39
-    function getPayload()
40
-    {
41
-        return array(
42
-        );
43
-    }
44
-    function getMethod()
45
-    {
46
-        return 'GET';
47
-    }
37
+		return $apiEndPoint;
38
+	}
39
+	function getPayload()
40
+	{
41
+		return array(
42
+		);
43
+	}
44
+	function getMethod()
45
+	{
46
+		return 'GET';
47
+	}
48 48
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@
 block discarded – undo
31 31
     {
32 32
         $apiEndPoint = $this->getUrl();
33 33
         //echo $GLOBALS['lastPostId'];
34
-        if ($this->getLastPostId() != "") {
34
+        if ($this->getLastPostId() != "")
35
+        {
35 36
 			$apiEndPoint = $this->getUrl() . '/location/?after=' . $this->getLastPostId();
36 37
 		}
37 38
         return $apiEndPoint;
Please login to merge, or discard this patch.
php/Requests/Upvote.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -3,19 +3,19 @@
 block discarded – undo
3 3
 
4 4
 class Upvote extends AbstractRequest {
5 5
 		
6
-    function getApiEndPoint()
7
-    {
8
-        return '/v2/posts/' . $_GET['postID'] . '/upvote';
9
-    }
10
-    function getPayload()
11
-    {
12
-        return array(
6
+	function getApiEndPoint()
7
+	{
8
+		return '/v2/posts/' . $_GET['postID'] . '/upvote';
9
+	}
10
+	function getPayload()
11
+	{
12
+		return array(
13 13
 					"reason_code" => -1,
14
-        );
15
-    }
16
-    function getMethod()
17
-    {
18
-        return 'PUT';
19
-    }
14
+		);
15
+	}
16
+	function getMethod()
17
+	{
18
+		return 'PUT';
19
+	}
20 20
 }
21 21
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 
4
-class Upvote extends AbstractRequest {
4
+class Upvote extends AbstractRequest
5
+{
5 6
 		
6 7
     function getApiEndPoint()
7 8
     {
Please login to merge, or discard this patch.
php/Requests/GetPostDetails.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -3,18 +3,18 @@
 block discarded – undo
3 3
 
4 4
 class GetPostDetails extends AbstractRequest {
5 5
 		
6
-    function getApiEndPoint()
7
-    {
8
-        return '/v2/posts/' . $_GET['postID'];
9
-    }
10
-    function getPayload()
11
-    {
12
-        return array(
13
-        );
14
-    }
15
-    function getMethod()
16
-    {
17
-        return 'GET';
18
-    }
6
+	function getApiEndPoint()
7
+	{
8
+		return '/v2/posts/' . $_GET['postID'];
9
+	}
10
+	function getPayload()
11
+	{
12
+		return array(
13
+		);
14
+	}
15
+	function getMethod()
16
+	{
17
+		return 'GET';
18
+	}
19 19
 }
20 20
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 
4
-class GetPostDetails extends AbstractRequest {
4
+class GetPostDetails extends AbstractRequest
5
+{
5 6
 		
6 7
     function getApiEndPoint()
7 8
     {
Please login to merge, or discard this patch.
php/Requests/Downvote.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -3,18 +3,18 @@
 block discarded – undo
3 3
 
4 4
 class Downvote extends AbstractRequest {
5 5
 		
6
-    function getApiEndPoint()
7
-    {
8
-        return '/v2/posts/' . $_GET['postID'] . '/downvote';
9
-    }
10
-    function getPayload()
11
-    {
12
-        return array(
13
-        );
14
-    }
15
-    function getMethod()
16
-    {
17
-        return 'PUT';
18
-    }
6
+	function getApiEndPoint()
7
+	{
8
+		return '/v2/posts/' . $_GET['postID'] . '/downvote';
9
+	}
10
+	function getPayload()
11
+	{
12
+		return array(
13
+		);
14
+	}
15
+	function getMethod()
16
+	{
17
+		return 'PUT';
18
+	}
19 19
 }
20 20
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 
4
-class Downvote extends AbstractRequest {
4
+class Downvote extends AbstractRequest
5
+{
5 6
 		
6 7
     function getApiEndPoint()
7 8
     {
Please login to merge, or discard this patch.
index.php 1 patch
Braces   +81 added lines, -27 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@  discard block
 block discarded – undo
31 31
 	//createAccount();
32 32
 	
33 33
 	//Set Location
34
-	if(isset($_GET['city'])) {
34
+	if(isset($_GET['city']))
35
+	{
35 36
 		
36 37
 		$url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . $_GET['city'] . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w';
37 38
 		$result = Requests::post($url);
@@ -53,11 +54,14 @@  discard block
 block discarded – undo
53 54
 	}
54 55
 	
55 56
 	//Vote
56
-	if(isset($_GET['vote']) && isset($_GET['postID'])) {
57
-		if($_GET['vote'] == "up") {
57
+	if(isset($_GET['vote']) && isset($_GET['postID']))
58
+	{
59
+		if($_GET['vote'] == "up")
60
+		{
58 61
 			$accountCreator = new Upvote();
59 62
 		}
60
-		else if($_GET['vote'] == "down") {
63
+		else if($_GET['vote'] == "down")
64
+		{
61 65
 			$accountCreator = new Downvote();
62 66
 		}
63 67
 		$accountCreator->setAccessToken($accessToken);
@@ -69,7 +73,8 @@  discard block
 block discarded – undo
69 73
 	
70 74
 	
71 75
 	//SendJodel
72
-	if(isset($_POST['message'])) {
76
+	if(isset($_POST['message']))
77
+	{
73 78
 		$ancestor;
74 79
 		if(isset($_POST['ancestor']))
75 80
 		{
@@ -113,7 +118,11 @@  discard block
 block discarded – undo
113 118
 			<a href="index.php">
114 119
 				<h1>
115 120
 					Jodel WebClient
116
-					<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) echo '<i class="fa fa-refresh fa-1x"></i>';?>
121
+					<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails']))
122
+{
123
+	echo '<i class="fa fa-refresh fa-1x"></i>';
124
+}
125
+?>
117 126
 				</h1>					
118 127
 			</a>
119 128
 			<div class="clear"></div>
@@ -128,7 +137,8 @@  discard block
 block discarded – undo
128 137
 							$posts;
129 138
 
130 139
 							//Get Post Details
131
-							if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) {
140
+							if(isset($_GET['postID']) && isset($_GET['getPostDetails']))
141
+							{
132 142
 								//Header Nav in Comment View
133 143
 								?>
134 144
 								<a id="comment-back" href="index.php#postId-<?php echo $_GET['postID'];?>">
@@ -146,17 +156,22 @@  discard block
 block discarded – undo
146 156
 								$data = $accountCreator->execute();
147 157
 								
148 158
 								$posts[0] = $data;
149
-								if(isset($data['children'])) {
150
-									foreach($data['children'] as $child) {
159
+								if(isset($data['children']))
160
+								{
161
+									foreach($data['children'] as $child)
162
+									{
151 163
 										array_push($posts, $child);
152 164
 									}
153 165
 									$loops = $data['child_count'] + 1;
154 166
 								}
155
-								else $loops = 1;
167
+								else {
168
+									$loops = 1;
169
+								}
156 170
 								$showCommentIcon = FALSE;
157 171
 							}
158 172
 							//Get Posts
159
-							else {
173
+							else
174
+							{
160 175
 								if(isset($_GET['commentView']))
161 176
 								{
162 177
 									$commentView = true;
@@ -182,9 +197,11 @@  discard block
 block discarded – undo
182 197
 							}
183 198
 							
184 199
 
185
-							for($i = 0; $i<$loops; $i++) {
200
+							for($i = 0; $i<$loops; $i++)
201
+							{
186 202
 							
187
-							if(isset($posts[$i])) {
203
+							if(isset($posts[$i]))
204
+							{
188 205
 							$lastPostId = $posts[$i]['post_id'];
189 206
 
190 207
 							
@@ -200,7 +217,8 @@  discard block
 block discarded – undo
200 217
 							$timediff_inHours = (string)$timediff->format('%h');
201 218
 							$timediff_inDays = (string)$timediff->format('%d');
202 219
 							$timediff_inMonth = (string)$timediff->format('%m');
203
-							if($timediff_inMonth!=0) {
220
+							if($timediff_inMonth!=0)
221
+							{
204 222
 									$timediff = $timediff_inMonth . "m";
205 223
 							}
206 224
 							else
@@ -233,10 +251,12 @@  discard block
 block discarded – undo
233 251
 						<article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;">
234 252
 							<content>
235 253
 								<?php 
236
-								if(isset($posts[$i]["image_url"])) {
254
+								if(isset($posts[$i]["image_url"]))
255
+								{
237 256
 									echo '<img src="' . $posts[$i]["image_url"] . '">';
238 257
 								}
239
-								else {
258
+								else
259
+								{
240 260
 									echo nl2br($posts[$i]["message"]);
241 261
 								}
242 262
 								?>
@@ -262,13 +282,19 @@  discard block
 block discarded – undo
262 282
 											</span> 
263 283
 										</td>
264 284
 										<td class="comments">
265
-											<?php if($showCommentIcon) {?>
285
+											<?php if($showCommentIcon)
286
+{
287
+?>
266 288
 											<span data-tooltip="Comments">
267 289
 												<a href="index.php?getPostDetails=true&postID=<?php echo $posts[$i]["post_id"];?>">
268 290
 													<i class="fa fa-commenting-o"></i>
269
-													<?php if(array_key_exists("child_count", $posts[$i])) {
291
+													<?php if(array_key_exists("child_count", $posts[$i]))
292
+{
270 293
 																echo $posts[$i]["child_count"];
271
-															} else echo "0";
294
+															}
295
+															else {
296
+																echo "0";
297
+															}
272 298
 													?>
273 299
 													</a>
274 300
 											</span>
@@ -292,15 +318,29 @@  discard block
 block discarded – undo
292 318
 					</content>
293 319
 							
294 320
 				</article>
295
-				<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?>
321
+				<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails']))
322
+{
323
+?>
296 324
 				<p id="loading">
297 325
 					<img src="images/loading.gif" alt="Loading…" />
298 326
 				</p>
299 327
 				<?php } ?>
300 328
 				<nav id="sortJodelBy">
301
-					<a href="index.php" <?php if(isset($timeView)) echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a>
302
-					<a href="index.php?commentView=true" <?php if(isset($commentView)) echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a>
303
-					<a href="index.php?upVoteView=true" <?php if(isset($upVoteView)) echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a>
329
+					<a href="index.php" <?php if(isset($timeView))
330
+{
331
+	echo 'class="active"';
332
+}
333
+?>><i class="fa fa-clock-o fa-3x"></i></a>
334
+					<a href="index.php?commentView=true" <?php if(isset($commentView))
335
+{
336
+	echo 'class="active"';
337
+}
338
+?>><i class="fa fa-commenting-o fa-3x"></i></a>
339
+					<a href="index.php?upVoteView=true" <?php if(isset($upVoteView))
340
+{
341
+	echo 'class="active"';
342
+}
343
+?>><i class="fa fa-angle-up fa-3x"></i></a>
304 344
 				</nav>
305 345
 			</div>
306 346
 			
@@ -308,7 +348,14 @@  discard block
 block discarded – undo
308 348
 				<article>
309 349
 					<h3>Position</h3>
310 350
 					<form method="get">
311
-						<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; else echo $posts[0]["location"]["name"]; ?>" required>
351
+						<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus))
352
+{
353
+	echo $newPositionStatus;
354
+}
355
+else {
356
+	echo $posts[0]["location"]["name"];
357
+}
358
+?>" required>
312 359
 
313 360
 						<input type="submit" value="Set Location" /> 
314 361
 					</form>
@@ -321,7 +368,9 @@  discard block
 block discarded – undo
321 368
 				</article>
322 369
 
323 370
 				<article>
324
-					<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?>
371
+					<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails']))
372
+{
373
+?>
325 374
 					<h2>Comment on Jodel</h2>
326 375
 					<form method="POST">				
327 376
 							<input type="hidden" name="ancestor" value="<?php echo $_GET['postID'];?>" />
@@ -329,7 +378,10 @@  discard block
 block discarded – undo
329 378
 						<br />
330 379
 						<input type="submit" value="SEND" /> 
331 380
 					</form>
332
-						<?php } else { ?>
381
+						<?php }
382
+else
383
+{
384
+?>
333 385
 					<h2>New Jodel</h2>
334 386
 					<form method="POST">
335 387
 						<textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> 
@@ -358,7 +410,9 @@  discard block
 block discarded – undo
358 410
 			    $(this).addClass('selected');
359 411
 			});
360 412
 
361
-			<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?>
413
+			<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails']))
414
+{
415
+?>
362 416
 			$(document).ready(function() {
363 417
 				var win = $(window);
364 418
 				var lastPostId = "<?php echo $lastPostId; ?>";
Please login to merge, or discard this patch.
php/Requests/SetLocation.php 2 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -3,37 +3,37 @@
 block discarded – undo
3 3
 
4 4
 class UpdateLocation extends AbstractRequest {
5 5
 		 /**
6
-     * @var Location
7
-     */
8
-    public $location;
9
-    /**
10
-     * @return Location
11
-     */
12
-    public function getLocation(): Location
13
-    {
14
-        return $this->location;
15
-    }
16
-    /**
17
-     * @param Location $location
18
-     */
19
-    public function setLocation(Location $location)
20
-    {
21
-        $this->location = $location;
22
-    }
6
+		  * @var Location
7
+		  */
8
+	public $location;
9
+	/**
10
+	 * @return Location
11
+	 */
12
+	public function getLocation(): Location
13
+	{
14
+		return $this->location;
15
+	}
16
+	/**
17
+	 * @param Location $location
18
+	 */
19
+	public function setLocation(Location $location)
20
+	{
21
+		$this->location = $location;
22
+	}
23 23
 		
24
-    function getApiEndPoint()
25
-    {
26
-        return '/v2/users/location';
27
-    }
28
-    function getPayload()
29
-    {
30
-        return array(
24
+	function getApiEndPoint()
25
+	{
26
+		return '/v2/users/location';
27
+	}
28
+	function getPayload()
29
+	{
30
+		return array(
31 31
 					"location" => $this->getLocation()->toArray(),
32
-        );
33
-    }
34
-    function getMethod()
35
-    {
36
-        return 'PUT';
37
-    }
32
+		);
33
+	}
34
+	function getMethod()
35
+	{
36
+		return 'PUT';
37
+	}
38 38
 }
39 39
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 
4
-class SetLocation extends AbstractRequest {
4
+class SetLocation extends AbstractRequest
5
+{
5 6
 		 /**
6 7
      * @var Location
7 8
      */
Please login to merge, or discard this patch.
php/Requests/CreateUser.php 2 patches
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class CreateUser extends AbstractRequest {
3
+class CreateUser extends AbstractRequest
4
+{
4 5
     /**
5 6
      * @var Location
6 7
      */
@@ -25,7 +26,7 @@  discard block
 block discarded – undo
25 26
 		return $this->deviceUid;
26 27
 	}
27 28
 	public function setDeviceUid($deviceUid)
28
-    {
29
+	{
29 30
 			$this->deviceUid = $deviceUid;
30 31
 	}
31 32
     public function generateDeviceUid()
@@ -36,7 +37,8 @@  discard block
 block discarded – undo
36 37
     {
37 38
         $str = '';
38 39
         $max = mb_strlen($keyspace, '8bit') - 1;
39
-        for ($i = 0; $i < $length; ++$i) {
40
+        for ($i = 0; $i < $length; ++$i)
41
+        {
40 42
             $str .= $keyspace[random_int(0, $max)];
41 43
         }
42 44
         return $str;
Please login to merge, or discard this patch.
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -1,53 +1,53 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class CreateUser extends AbstractRequest {
4
-    /**
5
-     * @var Location
6
-     */
7
-    private $location;
8
-    private $deviceUid;
9
-    /**
10
-     * @return Location
11
-     */
12
-    private function getLocation()
13
-    {
14
-        return $this->location;
15
-    }
16
-    /**
17
-     * @param Location $location
18
-     */
19
-    public function setLocation(Location $location)
20
-    {
21
-        $this->location = $location;
22
-    }
23
-    private function getDeviceUid()
24
-    {
4
+	/**
5
+	 * @var Location
6
+	 */
7
+	private $location;
8
+	private $deviceUid;
9
+	/**
10
+	 * @return Location
11
+	 */
12
+	private function getLocation()
13
+	{
14
+		return $this->location;
15
+	}
16
+	/**
17
+	 * @param Location $location
18
+	 */
19
+	public function setLocation(Location $location)
20
+	{
21
+		$this->location = $location;
22
+	}
23
+	private function getDeviceUid()
24
+	{
25 25
 		return $this->deviceUid;
26 26
 	}
27 27
 	public function setDeviceUid($deviceUid)
28
-    {
28
+	{
29 29
 			$this->deviceUid = $deviceUid;
30 30
 	}
31
-    private function generateDeviceUid()
32
-    {
33
-        return $this->random_str(64, 'abcdef0123456789');
34
-    }
31
+	private function generateDeviceUid()
32
+	{
33
+		return $this->random_str(64, 'abcdef0123456789');
34
+	}
35 35
     
36
-    private function random_str($length, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
37
-    {
38
-        $str = '';
39
-        $max = mb_strlen($keyspace, '8bit') - 1;
40
-        for ($i = 0; $i < $length; ++$i) {
41
-            $str .= $keyspace[random_int(0, $max)];
42
-        }
43
-        return $str;
44
-    }
45
-    public function getApiEndPoint()
46
-    {
47
-        return '/v2/users';
48
-    }
49
-    public function getPayload()
50
-    {
36
+	private function random_str($length, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
37
+	{
38
+		$str = '';
39
+		$max = mb_strlen($keyspace, '8bit') - 1;
40
+		for ($i = 0; $i < $length; ++$i) {
41
+			$str .= $keyspace[random_int(0, $max)];
42
+		}
43
+		return $str;
44
+	}
45
+	public function getApiEndPoint()
46
+	{
47
+		return '/v2/users';
48
+	}
49
+	public function getPayload()
50
+	{
51 51
 			if(!isset($this->deviceUid))
52 52
 			{
53 53
 				$this->setDeviceUid($this->generateDeviceUid());
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
 					"client_id" => self::CLIENTID,
59 59
 					"device_uid" => $this->getDeviceUid(),
60 60
 			);
61
-    }
62
-    public function getMethod()
63
-    {
64
-        return 'POST';
65
-    }
61
+	}
62
+	public function getMethod()
63
+	{
64
+		return 'POST';
65
+	}
66 66
 }
Please login to merge, or discard this patch.