Completed
Push — master ( 77d52d...114bc4 )
by mains
02:34
created
php/Requests/libary/Requests/Proxy.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,5 +31,5 @@
 block discarded – undo
31 31
 	 * @see Requests_Hooks::register
32 32
 	 * @param Requests_Hooks $hooks Hook system
33 33
 	 */
34
-	public function register(Requests_Hooks &$hooks);
34
+	public function register(Requests_Hooks&$hooks);
35 35
 }
36 36
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,8 @@
 block discarded – undo
20 20
  * @subpackage Proxy
21 21
  * @since 1.6
22 22
  */
23
-interface Requests_Proxy {
23
+interface Requests_Proxy
24
+{
24 25
 	/**
25 26
 	 * Register hooks as needed
26 27
 	 *
Please login to merge, or discard this patch.
php/Location.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class Location{
3
+class Location {
4 4
 
5 5
     public $cityName;
6 6
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     {
38 38
         $this->lng = $lng;
39 39
     }
40
-    public function toArray(){
40
+    public function toArray() {
41 41
         return array(
42 42
             "city" => $this->getCityName(),
43 43
             "country" => 'DE',
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class Location{
3
+class Location
4
+{
4 5
 
5 6
     public $cityName;
6 7
 
@@ -37,7 +38,8 @@  discard block
 block discarded – undo
37 38
     {
38 39
         $this->lng = $lng;
39 40
     }
40
-    public function toArray(){
41
+    public function toArray()
42
+    {
41 43
         return array(
42 44
             "city" => $this->getCityName(),
43 45
             "country" => 'DE',
Please login to merge, or discard this patch.
php/DatabaseConnect.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 
13 13
 }
14 14
 $db = new DatabaseConnect();
15
-if ($db->connect_errno) {
15
+if($db->connect_errno) {
16 16
   echo 'Sorry, die Verbindung zu unserem superfetten endgeilen 
17 17
         Server ist hops gegangen. Wegen '.$db -> connect_error;
18 18
 }
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 1 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/SetLocation.php 1 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
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
     {
37 37
         $str = '';
38 38
         $max = mb_strlen($keyspace, '8bit') - 1;
39
-        for ($i = 0; $i < $length; ++$i) {
39
+        for($i = 0; $i < $length; ++$i) {
40 40
             $str .= $keyspace[random_int(0, $max)];
41 41
         }
42 42
         return $str;
Please login to merge, or discard this patch.
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.
php/Requests/GetPosts.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,22 +7,22 @@  discard block
 block discarded – undo
7 7
 
8 8
     public $url;
9 9
         
10
-    function setUrl ($url)
10
+    function setUrl($url)
11 11
     {
12 12
             $this->url = $url;
13 13
     }
14 14
     
15
-    function getUrl ()
15
+    function getUrl()
16 16
     {
17 17
         return $this->url;
18 18
     }
19 19
 		
20
-    function setLastPostId ($lastPostId)
20
+    function setLastPostId($lastPostId)
21 21
     {
22 22
 			$this->lastPostId = $lastPostId;
23 23
 	}
24 24
 	
25
-	function getlastPostId ()
25
+	function getlastPostId()
26 26
 	{
27 27
 		return $this->lastPostId;
28 28
 	}
@@ -31,7 +31,7 @@  discard block
 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
 			$apiEndPoint = $this->getUrl() . '/location/?after=' . $this->getLastPostId();
36 36
 		}
37 37
         return $apiEndPoint;
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 1 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/AbstractRequest.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         $header = $this->getSignHeaders();
29 29
         $url = $this->getFullUrl();
30 30
 
31
-        if ($this->getAccessToken()) {
31
+        if($this->getAccessToken()) {
32 32
             $header['Authorization'] = "Bearer " . $this->getAccessToken();
33 33
         }
34 34
         //Comment out to debug the Request:
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         */
40 40
         
41 41
 
42
-        switch ($this->getMethod()) {
42
+        switch($this->getMethod()) {
43 43
             case 'POST':
44 44
                 $result = Requests::post($url, $header, $this->payLoad);
45 45
                 break;
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
                 $result = Requests::put($url, $header, $this->payLoad);
51 51
                 break;
52 52
         }
53
-        switch ($result->status_code) {
53
+        switch($result->status_code) {
54 54
             case 200:
55 55
                 $result = json_decode($result->body, true);
56 56
                 break;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
                 throw  new \Exception('Signing failed!');
68 68
                 break;
69 69
             default:
70
-                throw  new \Exception('Unknown Error: '.$result->status_code);
70
+                throw  new \Exception('Unknown Error: ' . $result->status_code);
71 71
         }
72 72
 
73 73
         if($device_uid != "")
Please login to merge, or discard this patch.
Braces   +13 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
 abstract class AbstractRequest
4
-{	
4
+{
5 5
     CONST CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26';
6 6
     CONST APIURL = 'https://api.go-tellm.com/api';
7 7
     const SECRET = "VwJHzYUbPjGiXWauoVNaHoCWsaacTmnkGwNtHhjy";
@@ -19,7 +19,8 @@  discard block
 block discarded – undo
19 19
 		        
20 20
 		$this->payLoad = $this->getPayload();
21 21
 		$device_uid = "";
22
-		if(isset($this->payLoad["device_uid"])) {
22
+		if(isset($this->payLoad["device_uid"]))
23
+		{
23 24
 			$device_uid = $this->payLoad["device_uid"];
24 25
 		}
25 26
 				
@@ -28,7 +29,8 @@  discard block
 block discarded – undo
28 29
         $header = $this->getSignHeaders();
29 30
         $url = $this->getFullUrl();
30 31
 
31
-        if ($this->getAccessToken()) {
32
+        if ($this->getAccessToken())
33
+        {
32 34
             $header['Authorization'] = "Bearer " . $this->getAccessToken();
33 35
         }
34 36
         //Comment out to debug the Request:
@@ -39,7 +41,8 @@  discard block
 block discarded – undo
39 41
         */
40 42
         
41 43
 
42
-        switch ($this->getMethod()) {
44
+        switch ($this->getMethod())
45
+        {
43 46
             case 'POST':
44 47
                 $result = Requests::post($url, $header, $this->payLoad);
45 48
                 break;
@@ -50,7 +53,8 @@  discard block
 block discarded – undo
50 53
                 $result = Requests::put($url, $header, $this->payLoad);
51 54
                 break;
52 55
         }
53
-        switch ($result->status_code) {
56
+        switch ($result->status_code)
57
+        {
54 58
             case 200:
55 59
                 $result = json_decode($result->body, true);
56 60
                 break;
@@ -90,10 +94,12 @@  discard block
 block discarded – undo
90 94
     public function getSignHeaders()
91 95
     {
92 96
 			$payload_accessToken;
93
-			if($this->getAccessToken() == null) {
97
+			if($this->getAccessToken() == null)
98
+			{
94 99
 				$payload_accessToken = "";
95 100
 			}
96
-			else {
101
+			else
102
+			{
97 103
 				$payload_accessToken = $this->getAccessToken();
98 104
 			}
99 105
 			
Please login to merge, or discard this patch.