Completed
Push — master ( 6fce2f...9d108c )
by mains
16:33
created
php/Requests/libary/Requests/Exception/Transport/cURL.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -29,6 +29,9 @@
 block discarded – undo
29 29
 	 */
30 30
 	protected $reason = 'Unknown';
31 31
 
32
+	/**
33
+	 * @param string $message
34
+	 */
32 35
 	public function __construct($message, $type, $data = null, $code = 0) {
33 36
 		if ($type !== null) {
34 37
 			$this->type = $type;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,15 +30,15 @@
 block discarded – undo
30 30
 	protected $reason = 'Unknown';
31 31
 
32 32
 	public function __construct($message, $type, $data = null, $code = 0) {
33
-		if ($type !== null) {
33
+		if($type !== null) {
34 34
 			$this->type = $type;
35 35
 		}
36 36
 
37
-		if ($code !== null) {
37
+		if($code !== null) {
38 38
 			$this->code = $code;
39 39
 		}
40 40
 
41
-		if ($message !== null) {
41
+		if($message !== null) {
42 42
 			$this->reason = $message;
43 43
 		}
44 44
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class Requests_Exception_Transport_cURL extends Requests_Exception_Transport {
3
+class Requests_Exception_Transport_cURL extends Requests_Exception_Transport
4
+{
4 5
 
5 6
 	const EASY = 'cURLEasy';
6 7
 	const MULTI = 'cURLMulti';
@@ -29,16 +30,20 @@  discard block
 block discarded – undo
29 30
 	 */
30 31
 	protected $reason = 'Unknown';
31 32
 
32
-	public function __construct($message, $type, $data = null, $code = 0) {
33
-		if ($type !== null) {
33
+	public function __construct($message, $type, $data = null, $code = 0)
34
+	{
35
+		if ($type !== null)
36
+		{
34 37
 			$this->type = $type;
35 38
 		}
36 39
 
37
-		if ($code !== null) {
40
+		if ($code !== null)
41
+		{
38 42
 			$this->code = $code;
39 43
 		}
40 44
 
41
-		if ($message !== null) {
45
+		if ($message !== null)
46
+		{
42 47
 			$this->reason = $message;
43 48
 		}
44 49
 
@@ -49,7 +54,8 @@  discard block
 block discarded – undo
49 54
 	/**
50 55
 	 * Get the error message
51 56
 	 */
52
-	public function getReason() {
57
+	public function getReason()
58
+	{
53 59
 		return $this->reason;
54 60
 	}
55 61
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,16 +29,16 @@
 block discarded – undo
29 29
 	 */
30 30
 	protected $reason = 'Unknown';
31 31
 
32
-	public function __construct($message, $type, $data = null, $code = 0) {
33
-		if ($type !== null) {
32
+	public function __construct($message, $type, $data = NULL, $code = 0) {
33
+		if ($type !== NULL) {
34 34
 			$this->type = $type;
35 35
 		}
36 36
 
37
-		if ($code !== null) {
37
+		if ($code !== NULL) {
38 38
 			$this->code = $code;
39 39
 		}
40 40
 
41
-		if ($message !== null) {
41
+		if ($message !== NULL) {
42 42
 			$this->reason = $message;
43 43
 		}
44 44
 
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Hooker.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -19,6 +19,7 @@
 block discarded – undo
19 19
 	 * @param string $hook Hook name
20 20
 	 * @param callback $callback Function/method to call on event
21 21
 	 * @param int $priority Priority number. <0 is executed earlier, >0 is executed later
22
+	 * @return void
22 23
 	 */
23 24
 	public function register($hook, $callback, $priority = 0);
24 25
 
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
  * @package Requests
13 13
  * @subpackage Utilities
14 14
  */
15
-interface Requests_Hooker {
15
+interface Requests_Hooker
16
+{
16 17
 	/**
17 18
 	 * Register a callback for a hook
18 19
 	 *
Please login to merge, or discard this patch.
php/Requests/SetLocation.php 2 patches
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.
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()
13
-    {
14
-        return $this->location;
15
-    }
16
-    /**
17
-     * @param Location $location
18
-     */
19
-    public function setLocation($location)
20
-    {
21
-        $this->location = $location;
22
-    }
6
+		  * @var Location
7
+		  */
8
+	public $location;
9
+	/**
10
+	 * @return Location
11
+	 */
12
+	public function getLocation()
13
+	{
14
+		return $this->location;
15
+	}
16
+	/**
17
+	 * @param Location $location
18
+	 */
19
+	public function setLocation($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.
php/Requests/CreateUser.php 4 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.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -33,6 +33,9 @@
 block discarded – undo
33 33
         return $this->random_str(64, 'abcdef0123456789');
34 34
     }
35 35
     
36
+    /**
37
+     * @param integer $length
38
+     */
36 39
     private function random_str($length, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
37 40
     {
38 41
         $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.
php/Requests/GetPosts.php 3 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.
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -4,25 +4,25 @@  discard block
 block discarded – undo
4 4
 {
5 5
 	public $lastPostId;
6 6
 
7
-    /**
8
-     * @var Location
9
-     */
10
-    public $location;
11
-    public $url;
7
+	/**
8
+	 * @var Location
9
+	 */
10
+	public $location;
11
+	public $url;
12 12
 
13 13
         
14
-    function setUrl ($url)
15
-    {
16
-            $this->url = $url;
17
-    }
14
+	function setUrl ($url)
15
+	{
16
+			$this->url = $url;
17
+	}
18 18
     
19
-    function getUrl ()
20
-    {
21
-        return $this->url;
22
-    }
19
+	function getUrl ()
20
+	{
21
+		return $this->url;
22
+	}
23 23
 		
24
-    function setLastPostId ($lastPostId)
25
-    {
24
+	function setLastPostId ($lastPostId)
25
+	{
26 26
 			$this->lastPostId = $lastPostId;
27 27
 	}
28 28
 	
@@ -31,38 +31,38 @@  discard block
 block discarded – undo
31 31
 		return $this->lastPostId;
32 32
 	}
33 33
     
34
-    function getApiEndPoint()
35
-    {
36
-        $apiEndPoint = $this->getUrl();
34
+	function getApiEndPoint()
35
+	{
36
+		$apiEndPoint = $this->getUrl();
37 37
 
38
-        if ($this->getLastPostId() != "") {
38
+		if ($this->getLastPostId() != "") {
39 39
 			$apiEndPoint = $this->getUrl() . '?after=' . $this->getLastPostId();
40 40
 		}
41
-        return $apiEndPoint;
42
-    }
43
-    function getPayload()
44
-    {
45
-        if($this->version == 'v3')
46
-        {
47
-            $this->location = new Location();
48
-            $this->location->setLat(52.520006);
49
-            $this->location->setLng(13.404954);
50
-            $this->location->setCityName('Berlin');
41
+		return $apiEndPoint;
42
+	}
43
+	function getPayload()
44
+	{
45
+		if($this->version == 'v3')
46
+		{
47
+			$this->location = new Location();
48
+			$this->location->setLat(52.520006);
49
+			$this->location->setLng(13.404954);
50
+			$this->location->setCityName('Berlin');
51 51
 
52 52
 
53
-            return array(
54
-                "location" => $this->location->toArray(),
55
-                "stickies" => 'false',
56
-            );
57
-        }
58
-        else
59
-        {
60
-            return array(
61
-            );
62
-        }
63
-    }
64
-    function getMethod()
65
-    {
66
-        return 'GET';
67
-    }
53
+			return array(
54
+				"location" => $this->location->toArray(),
55
+				"stickies" => 'false',
56
+			);
57
+		}
58
+		else
59
+		{
60
+			return array(
61
+			);
62
+		}
63
+	}
64
+	function getMethod()
65
+	{
66
+		return 'GET';
67
+	}
68 68
 }
Please login to merge, or discard this patch.
php/Requests/Upvote.php 2 patches
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.
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2 2
 class Upvote extends AbstractRequest {
3 3
 		
4
-    public $postId;
4
+	public $postId;
5 5
 
6
-    function getApiEndPoint()
7
-    {
8
-        return '/v2/posts/' . $this->postId . '/upvote';
9
-    }
10
-    function getPayload()
11
-    {
12
-        return array(
6
+	function getApiEndPoint()
7
+	{
8
+		return '/v2/posts/' . $this->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.
php/Requests/AbstractRequest.php 4 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.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
     const USERAGENT = 'Jodel/4.31.1 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )';
9 9
     const CLIENT_TYPE = 'android_4.31.1';
10 10
     
11
-    private $accessToken = null;
11
+    private $accessToken = NULL;
12 12
     private $payLoad;
13 13
     public $expects = "";
14 14
     public $version = 'v2';
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         }
60 60
         switch ($result->status_code) {
61 61
             case 200:
62
-                $result = json_decode($result->body, true);
62
+                $result = json_decode($result->body, TRUE);
63 63
                 break;
64 64
             case 204:
65 65
                 $result = "Success";
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      */
97 97
     private function getSignHeaders()
98 98
     {
99
-			if($this->getAccessToken() == null) {
99
+			if($this->getAccessToken() == NULL) {
100 100
 				$payload_accessToken = "";
101 101
 			}
102 102
 			else {
Please login to merge, or discard this patch.
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -2,19 +2,19 @@  discard block
 block discarded – undo
2 2
 
3 3
 abstract class AbstractRequest
4 4
 {	
5
-    const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26';
6
-    const APIURL = 'https://api.go-tellm.com/api';
7
-    const SECRET = 'plerFToqEdWlzShdZlTywaCHRuzlKIMsNmOJVDGE';
8
-    const USERAGENT = 'Jodel/4.31.1 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )';
9
-    const CLIENT_TYPE = 'android_4.31.1';
5
+	const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26';
6
+	const APIURL = 'https://api.go-tellm.com/api';
7
+	const SECRET = 'plerFToqEdWlzShdZlTywaCHRuzlKIMsNmOJVDGE';
8
+	const USERAGENT = 'Jodel/4.31.1 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )';
9
+	const CLIENT_TYPE = 'android_4.31.1';
10 10
     
11
-    private $accessToken = null;
12
-    private $payLoad;
13
-    public $expects = "";
14
-    public $version = 'v2';
11
+	private $accessToken = null;
12
+	private $payLoad;
13
+	public $expects = "";
14
+	public $version = 'v2';
15 15
 
16
-    public function execute()
17
-    {
16
+	public function execute()
17
+	{
18 18
 		$result = new \stdClass();
19 19
 		        
20 20
 		$this->payLoad = $this->getPayload();
@@ -24,82 +24,82 @@  discard block
 block discarded – undo
24 24
 		}
25 25
 				
26 26
 				
27
-        $this->payLoad = json_encode($this->payLoad);
28
-        $header = $this->getSignHeaders();
29
-        $url = $this->getFullUrl();
27
+		$this->payLoad = json_encode($this->payLoad);
28
+		$header = $this->getSignHeaders();
29
+		$url = $this->getFullUrl();
30 30
 
31
-        if ($this->getAccessToken()) {
32
-            $header['Authorization'] = "Bearer " . $this->getAccessToken();
33
-        }
34
-        //Comment out to debug the Request:
31
+		if ($this->getAccessToken()) {
32
+			$header['Authorization'] = "Bearer " . $this->getAccessToken();
33
+		}
34
+		//Comment out to debug the Request:
35 35
         
36
-        /*
36
+		/*
37 37
         var_dump($url);
38 38
         var_dump($header);
39 39
         var_dump($this->payLoad);
40 40
         */
41 41
         
42 42
 
43
-        switch ($this->getMethod()) {
44
-            case 'POST':
45
-                $result = Requests::post($url, $header, $this->payLoad);
46
-                break;
47
-            case 'GET':
48
-                if($this->version == 'v3')
49
-                {
50
-                    $result = Requests::get($url, $header);
51
-                }
52
-                else
53
-                {
54
-                    $result = Requests::get($url, $header);
55
-                }
56
-                break;
57
-            case 'PUT':
58
-                $result = Requests::put($url, $header, $this->payLoad);
59
-                break;
60
-        }
61
-        switch ($result->status_code) {
62
-            case 200:
63
-                $result = json_decode($result->body, true);
64
-                break;
65
-            case 204:
66
-                $result = "Success";
67
-                break;
68
-            case 401:
43
+		switch ($this->getMethod()) {
44
+			case 'POST':
45
+				$result = Requests::post($url, $header, $this->payLoad);
46
+				break;
47
+			case 'GET':
48
+				if($this->version == 'v3')
49
+				{
50
+					$result = Requests::get($url, $header);
51
+				}
52
+				else
53
+				{
54
+					$result = Requests::get($url, $header);
55
+				}
56
+				break;
57
+			case 'PUT':
58
+				$result = Requests::put($url, $header, $this->payLoad);
59
+				break;
60
+		}
61
+		switch ($result->status_code) {
62
+			case 200:
63
+				$result = json_decode($result->body, true);
64
+				break;
65
+			case 204:
66
+				$result = "Success";
67
+				break;
68
+			case 401:
69 69
 				//throw new \Exception('Unauthorized');
70
-                break;
71
-            case 404:
72
-                //echo "Es wurde bereits gevoted";
70
+				break;
71
+			case 404:
72
+				//echo "Es wurde bereits gevoted";
73 73
 			case 477:
74
-                //echo "Es wurde bereits gevoted";
75
-                //throw  new \Exception('Signing failed!');
76
-                break;
77
-            case 429:
78
-            	exit("Error 429: Too Many Requests");
79
-            	break;
80
-            default:
81
-                throw  new \Exception('Unknown Error: '.$result->status_code);
82
-        }
74
+				//echo "Es wurde bereits gevoted";
75
+				//throw  new \Exception('Signing failed!');
76
+				break;
77
+			case 429:
78
+				exit("Error 429: Too Many Requests");
79
+				break;
80
+			default:
81
+				throw  new \Exception('Unknown Error: '.$result->status_code);
82
+		}
83 83
 
84
-        if($device_uid != "")
85
-        {
84
+		if($device_uid != "")
85
+		{
86 86
 			$result[0] = $result;
87 87
 			$result[1] = $device_uid;
88 88
 		}
89 89
 
90 90
         
91
-        /*var_dump($result);*/
91
+		/*var_dump($result);*/
92 92
         
93 93
 
94
-        return $result;
95
-    }
96
-    abstract function getPayload();
97
-    /**
98
-     * Gets Sign headers
99
-     * @return array headers
100
-     */
101
-    private function getSignHeaders()
102
-    {
94
+		return $result;
95
+	}
96
+	abstract function getPayload();
97
+	/**
98
+	 * Gets Sign headers
99
+	 * @return array headers
100
+	 */
101
+	private function getSignHeaders()
102
+	{
103 103
 			if($this->getAccessToken() == null) {
104 104
 				$payload_accessToken = "";
105 105
 			}
@@ -108,54 +108,54 @@  discard block
 block discarded – undo
108 108
 			}
109 109
 			
110 110
 			
111
-        $headers = array(
112
-            "Connection" => "keep-alive",
113
-            "Accept-Encoding" => "gzip",
114
-            "Content-Type" => "application/json; charset=UTF-8",
115
-            "User-Agent" => self::USERAGENT
116
-        );
117
-        $timestamp = new DateTime();
118
-        $timestamp = $timestamp->format(DateTime::ATOM);
119
-        $timestamp = substr($timestamp, 0, -6);
120
-        $timestamp .= "Z";
121
-        $urlParts = parse_url($this->getFullUrl());
122
-        $url2 = "";
123
-        $req = [$this->getMethod(),
124
-            $urlParts['host'],
125
-            "443",
126
-            $urlParts['path'],
127
-            $payload_accessToken,
128
-            $timestamp,
129
-            $url2,
130
-            $this->payLoad];
131
-        $reqString = implode("%", $req);
132
-        $secret = self::SECRET;
133
-        $signature = hash_hmac('sha1', $reqString, $secret);
134
-        $signature = strtoupper($signature);
135
-        $headers['X-Authorization'] = 'HMAC ' . $signature;
136
-        $headers['X-Client-Type'] = self::CLIENT_TYPE;
137
-        $headers['X-Timestamp'] = $timestamp;
138
-        $headers['X-Api-Version'] = '0.2';
139
-        return $headers;
140
-    }
141
-    private function getFullUrl()
142
-    {
143
-        return self::APIURL . $this->getApiEndPoint();
144
-    }
145
-    abstract function getApiEndPoint();
146
-    abstract function getMethod();
147
-    /**
148
-     * @return string
149
-     */
150
-    private function getAccessToken()
151
-    {
152
-        return $this->accessToken;
153
-    }
154
-    /**
155
-     * @param string $accessToken
156
-     */
157
-    public function setAccessToken($accessToken)
158
-    {
159
-        $this->accessToken = $accessToken;
160
-    }
111
+		$headers = array(
112
+			"Connection" => "keep-alive",
113
+			"Accept-Encoding" => "gzip",
114
+			"Content-Type" => "application/json; charset=UTF-8",
115
+			"User-Agent" => self::USERAGENT
116
+		);
117
+		$timestamp = new DateTime();
118
+		$timestamp = $timestamp->format(DateTime::ATOM);
119
+		$timestamp = substr($timestamp, 0, -6);
120
+		$timestamp .= "Z";
121
+		$urlParts = parse_url($this->getFullUrl());
122
+		$url2 = "";
123
+		$req = [$this->getMethod(),
124
+			$urlParts['host'],
125
+			"443",
126
+			$urlParts['path'],
127
+			$payload_accessToken,
128
+			$timestamp,
129
+			$url2,
130
+			$this->payLoad];
131
+		$reqString = implode("%", $req);
132
+		$secret = self::SECRET;
133
+		$signature = hash_hmac('sha1', $reqString, $secret);
134
+		$signature = strtoupper($signature);
135
+		$headers['X-Authorization'] = 'HMAC ' . $signature;
136
+		$headers['X-Client-Type'] = self::CLIENT_TYPE;
137
+		$headers['X-Timestamp'] = $timestamp;
138
+		$headers['X-Api-Version'] = '0.2';
139
+		return $headers;
140
+	}
141
+	private function getFullUrl()
142
+	{
143
+		return self::APIURL . $this->getApiEndPoint();
144
+	}
145
+	abstract function getApiEndPoint();
146
+	abstract function getMethod();
147
+	/**
148
+	 * @return string
149
+	 */
150
+	private function getAccessToken()
151
+	{
152
+		return $this->accessToken;
153
+	}
154
+	/**
155
+	 * @param string $accessToken
156
+	 */
157
+	public function setAccessToken($accessToken)
158
+	{
159
+		$this->accessToken = $accessToken;
160
+	}
161 161
 }
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Cookie/Jar.php 3 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 * @return Requests_Cookie
37 37
 	 */
38 38
 	public function normalize_cookie($cookie, $key = null) {
39
-		if ($cookie instanceof Requests_Cookie) {
39
+		if($cookie instanceof Requests_Cookie) {
40 40
 			return $cookie;
41 41
 		}
42 42
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * @return string Item value
72 72
 	 */
73 73
 	public function offsetGet($key) {
74
-		if (!isset($this->cookies[$key])) {
74
+		if(!isset($this->cookies[$key])) {
75 75
 			return null;
76 76
 		}
77 77
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @param string $value Item value
88 88
 	 */
89 89
 	public function offsetSet($key, $value) {
90
-		if ($key === null) {
90
+		if($key === null) {
91 91
 			throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset');
92 92
 		}
93 93
 
@@ -134,21 +134,21 @@  discard block
 block discarded – undo
134 134
 	 * @param array $options
135 135
 	 */
136 136
 	public function before_request($url, &$headers, &$data, &$type, &$options) {
137
-		if (!$url instanceof Requests_IRI) {
137
+		if(!$url instanceof Requests_IRI) {
138 138
 			$url = new Requests_IRI($url);
139 139
 		}
140 140
 
141
-		if (!empty($this->cookies)) {
141
+		if(!empty($this->cookies)) {
142 142
 			$cookies = array();
143
-			foreach ($this->cookies as $key => $cookie) {
143
+			foreach($this->cookies as $key => $cookie) {
144 144
 				$cookie = $this->normalize_cookie($cookie, $key);
145 145
 
146 146
 				// Skip expired cookies
147
-				if ($cookie->is_expired()) {
147
+				if($cookie->is_expired()) {
148 148
 					continue;
149 149
 				}
150 150
 
151
-				if ($cookie->domain_matches($url->host)) {
151
+				if($cookie->domain_matches($url->host)) {
152 152
 					$cookies[] = $cookie->format_for_header();
153 153
 				}
154 154
 			}
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 	 *
163 163
 	 * @var Requests_Response $response
164 164
 	 */
165
-	public function before_redirect_check(Requests_Response &$return) {
165
+	public function before_redirect_check(Requests_Response&$return) {
166 166
 		$url = $return->url;
167
-		if (!$url instanceof Requests_IRI) {
167
+		if(!$url instanceof Requests_IRI) {
168 168
 			$url = new Requests_IRI($url);
169 169
 		}
170 170
 
Please login to merge, or discard this patch.
Braces   +40 added lines, -20 removed lines patch added patch discarded remove patch
@@ -25,7 +25,8 @@  discard block
 block discarded – undo
25 25
 	 *
26 26
 	 * @param array $cookies Existing cookie values
27 27
 	 */
28
-	public function __construct($cookies = array()) {
28
+	public function __construct($cookies = array())
29
+	{
29 30
 		$this->cookies = $cookies;
30 31
 	}
31 32
 
@@ -35,8 +36,10 @@  discard block
 block discarded – undo
35 36
 	 * @param string|Requests_Cookie $cookie
36 37
 	 * @return Requests_Cookie
37 38
 	 */
38
-	public function normalize_cookie($cookie, $key = null) {
39
-		if ($cookie instanceof Requests_Cookie) {
39
+	public function normalize_cookie($cookie, $key = null)
40
+	{
41
+		if ($cookie instanceof Requests_Cookie)
42
+		{
40 43
 			return $cookie;
41 44
 		}
42 45
 
@@ -50,7 +53,8 @@  discard block
 block discarded – undo
50 53
 	 * @deprecated Use {@see Requests_Cookie_Jar::normalize_cookie}
51 54
 	 * @return Requests_Cookie
52 55
 	 */
53
-	public function normalizeCookie($cookie, $key = null) {
56
+	public function normalizeCookie($cookie, $key = null)
57
+	{
54 58
 		return $this->normalize_cookie($cookie, $key);
55 59
 	}
56 60
 
@@ -60,7 +64,8 @@  discard block
 block discarded – undo
60 64
 	 * @param string $key Item key
61 65
 	 * @return boolean Does the item exist?
62 66
 	 */
63
-	public function offsetExists($key) {
67
+	public function offsetExists($key)
68
+	{
64 69
 		return isset($this->cookies[$key]);
65 70
 	}
66 71
 
@@ -70,8 +75,10 @@  discard block
 block discarded – undo
70 75
 	 * @param string $key Item key
71 76
 	 * @return string Item value
72 77
 	 */
73
-	public function offsetGet($key) {
74
-		if (!isset($this->cookies[$key])) {
78
+	public function offsetGet($key)
79
+	{
80
+		if (!isset($this->cookies[$key]))
81
+		{
75 82
 			return null;
76 83
 		}
77 84
 
@@ -86,8 +93,10 @@  discard block
 block discarded – undo
86 93
 	 * @param string $key Item name
87 94
 	 * @param string $value Item value
88 95
 	 */
89
-	public function offsetSet($key, $value) {
90
-		if ($key === null) {
96
+	public function offsetSet($key, $value)
97
+	{
98
+		if ($key === null)
99
+		{
91 100
 			throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset');
92 101
 		}
93 102
 
@@ -99,7 +108,8 @@  discard block
 block discarded – undo
99 108
 	 *
100 109
 	 * @param string $key
101 110
 	 */
102
-	public function offsetUnset($key) {
111
+	public function offsetUnset($key)
112
+	{
103 113
 		unset($this->cookies[$key]);
104 114
 	}
105 115
 
@@ -108,7 +118,8 @@  discard block
 block discarded – undo
108 118
 	 *
109 119
 	 * @return ArrayIterator
110 120
 	 */
111
-	public function getIterator() {
121
+	public function getIterator()
122
+	{
112 123
 		return new ArrayIterator($this->cookies);
113 124
 	}
114 125
 
@@ -117,7 +128,8 @@  discard block
 block discarded – undo
117 128
 	 *
118 129
 	 * @param Requests_Hooker $hooks Hooking system
119 130
 	 */
120
-	public function register(Requests_Hooker $hooks) {
131
+	public function register(Requests_Hooker $hooks)
132
+	{
121 133
 		$hooks->register('requests.before_request', array($this, 'before_request'));
122 134
 		$hooks->register('requests.before_redirect_check', array($this, 'before_redirect_check'));
123 135
 	}
@@ -133,22 +145,28 @@  discard block
 block discarded – undo
133 145
 	 * @param string $type
134 146
 	 * @param array $options
135 147
 	 */
136
-	public function before_request($url, &$headers, &$data, &$type, &$options) {
137
-		if (!$url instanceof Requests_IRI) {
148
+	public function before_request($url, &$headers, &$data, &$type, &$options)
149
+	{
150
+		if (!$url instanceof Requests_IRI)
151
+		{
138 152
 			$url = new Requests_IRI($url);
139 153
 		}
140 154
 
141
-		if (!empty($this->cookies)) {
155
+		if (!empty($this->cookies))
156
+		{
142 157
 			$cookies = array();
143
-			foreach ($this->cookies as $key => $cookie) {
158
+			foreach ($this->cookies as $key => $cookie)
159
+			{
144 160
 				$cookie = $this->normalize_cookie($cookie, $key);
145 161
 
146 162
 				// Skip expired cookies
147
-				if ($cookie->is_expired()) {
163
+				if ($cookie->is_expired())
164
+				{
148 165
 					continue;
149 166
 				}
150 167
 
151
-				if ($cookie->domain_matches($url->host)) {
168
+				if ($cookie->domain_matches($url->host))
169
+				{
152 170
 					$cookies[] = $cookie->format_for_header();
153 171
 				}
154 172
 			}
@@ -162,9 +180,11 @@  discard block
 block discarded – undo
162 180
 	 *
163 181
 	 * @var Requests_Response $response
164 182
 	 */
165
-	public function before_redirect_check(Requests_Response &$return) {
183
+	public function before_redirect_check(Requests_Response &$return)
184
+	{
166 185
 		$url = $return->url;
167
-		if (!$url instanceof Requests_IRI) {
186
+		if (!$url instanceof Requests_IRI)
187
+		{
168 188
 			$url = new Requests_IRI($url);
169 189
 		}
170 190
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @param string|Requests_Cookie $cookie
36 36
 	 * @return Requests_Cookie
37 37
 	 */
38
-	public function normalize_cookie($cookie, $key = null) {
38
+	public function normalize_cookie($cookie, $key = NULL) {
39 39
 		if ($cookie instanceof Requests_Cookie) {
40 40
 			return $cookie;
41 41
 		}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * @deprecated Use {@see Requests_Cookie_Jar::normalize_cookie}
51 51
 	 * @return Requests_Cookie
52 52
 	 */
53
-	public function normalizeCookie($cookie, $key = null) {
53
+	public function normalizeCookie($cookie, $key = NULL) {
54 54
 		return $this->normalize_cookie($cookie, $key);
55 55
 	}
56 56
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function offsetGet($key) {
74 74
 		if (!isset($this->cookies[$key])) {
75
-			return null;
75
+			return NULL;
76 76
 		}
77 77
 
78 78
 		return $this->cookies[$key];
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @param string $value Item value
88 88
 	 */
89 89
 	public function offsetSet($key, $value) {
90
-		if ($key === null) {
90
+		if ($key === NULL) {
91 91
 			throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset');
92 92
 		}
93 93
 
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Auth.php 3 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
@@ -18,7 +18,8 @@
 block discarded – undo
18 18
  * @package Requests
19 19
  * @subpackage Authentication
20 20
  */
21
-interface Requests_Auth {
21
+interface Requests_Auth
22
+{
22 23
 	/**
23 24
 	 * Register hooks as needed
24 25
 	 *
Please login to merge, or discard this patch.
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -30,6 +30,7 @@
 block discarded – undo
30 30
 	 *
31 31
 	 * @see Requests_Hooks::register
32 32
 	 * @param Requests_Hooks $hooks Hook system
33
+	 * @return void
33 34
 	 */
34 35
 	public function register(Requests_Hooks &$hooks);
35 36
 }
36 37
\ No newline at end of file
Please login to merge, or discard this patch.