Completed
Push — master ( 906cba...a2b8a4 )
by mains
03:35
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.
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.
php/Requests/GetKarma.php 1 patch
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.
php/Requests/libary/Requests/Proxy.php 1 patch
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.
php/Requests/GetPostDetails.php 1 patch
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.
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.
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -2,51 +2,51 @@
 block discarded – undo
2 2
 
3 3
 class Location{
4 4
 
5
-    public $cityName;
6
-
7
-    public $lat;
8
-
9
-    public $lng;
10
-
11
-    public function getCityName()
12
-    {
13
-        return $this->cityName;
14
-    }
15
-
16
-    public function setCityName($cityName)
17
-    {
18
-        $this->cityName = $cityName;
19
-    }
20
-
21
-    public function getLat()
22
-    {
23
-        return $this->lat;
24
-    }
25
-
26
-    public function setLat($lat)
27
-    {
28
-        $this->lat = $lat;
29
-    }
30
-
31
-    public function getLng()
32
-    {
33
-        return $this->lng;
34
-    }
35
-
36
-    public function setLng($lng)
37
-    {
38
-        $this->lng = $lng;
39
-    }
40
-    public function toArray(){
41
-        return array(
42
-            "city" => $this->getCityName(),
43
-            "country" => 'DE',
44
-            "loc_accuracy" => '0.0',
45
-            "loc_coordinates" => array(
46
-                "lat" => $this->getLat(),
47
-                "lng" => $this->getLng(),
48
-            ),
49
-            "name" => $this->getCityName()
50
-        );
51
-    }
5
+	public $cityName;
6
+
7
+	public $lat;
8
+
9
+	public $lng;
10
+
11
+	public function getCityName()
12
+	{
13
+		return $this->cityName;
14
+	}
15
+
16
+	public function setCityName($cityName)
17
+	{
18
+		$this->cityName = $cityName;
19
+	}
20
+
21
+	public function getLat()
22
+	{
23
+		return $this->lat;
24
+	}
25
+
26
+	public function setLat($lat)
27
+	{
28
+		$this->lat = $lat;
29
+	}
30
+
31
+	public function getLng()
32
+	{
33
+		return $this->lng;
34
+	}
35
+
36
+	public function setLng($lng)
37
+	{
38
+		$this->lng = $lng;
39
+	}
40
+	public function toArray(){
41
+		return array(
42
+			"city" => $this->getCityName(),
43
+			"country" => 'DE',
44
+			"loc_accuracy" => '0.0',
45
+			"loc_coordinates" => array(
46
+				"lat" => $this->getLat(),
47
+				"lng" => $this->getLng(),
48
+			),
49
+			"name" => $this->getCityName()
50
+		);
51
+	}
52 52
 }
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.
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 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.
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/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.
Indentation   +116 added lines, -116 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 = "dIHNtHWOxFmoFouufSflpTKYjPmCIhWUCQHgbNzR";
8
-    const USERAGENT = "Jodel/4.29.1 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )";
9
-    const CLIENT_TYPE = 'android_4.29.1';
5
+	CONST CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26';
6
+	CONST APIURL = 'https://api.go-tellm.com/api';
7
+	const SECRET = "dIHNtHWOxFmoFouufSflpTKYjPmCIhWUCQHgbNzR";
8
+	const USERAGENT = "Jodel/4.29.1 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )";
9
+	const CLIENT_TYPE = 'android_4.29.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,78 +24,78 @@  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:
35
-        /*
31
+		if ($this->getAccessToken()) {
32
+			$header['Authorization'] = "Bearer " . $this->getAccessToken();
33
+		}
34
+		//Comment out to debug the Request:
35
+		/*
36 36
         var_dump($url);
37 37
         var_dump($header);
38 38
         var_dump($this->payLoad);
39 39
         */
40 40
         
41 41
 
42
-        switch ($this->getMethod()) {
43
-            case 'POST':
44
-                $result = Requests::post($url, $header, $this->payLoad);
45
-                break;
46
-            case 'GET':
47
-                if($this->version == 'v3')
48
-                {
49
-                    $result = Requests::get($url, $header);
50
-                }
51
-                else
52
-                {
53
-                    $result = Requests::get($url, $header);
54
-                }
55
-                break;
56
-            case 'PUT':
57
-                $result = Requests::put($url, $header, $this->payLoad);
58
-                break;
59
-        }
60
-        switch ($result->status_code) {
61
-            case 200:
62
-                $result = json_decode($result->body, true);
63
-                break;
64
-            case 204:
65
-                $result = "Success";
66
-                break;
67
-            case 401:
42
+		switch ($this->getMethod()) {
43
+			case 'POST':
44
+				$result = Requests::post($url, $header, $this->payLoad);
45
+				break;
46
+			case 'GET':
47
+				if($this->version == 'v3')
48
+				{
49
+					$result = Requests::get($url, $header);
50
+				}
51
+				else
52
+				{
53
+					$result = Requests::get($url, $header);
54
+				}
55
+				break;
56
+			case 'PUT':
57
+				$result = Requests::put($url, $header, $this->payLoad);
58
+				break;
59
+		}
60
+		switch ($result->status_code) {
61
+			case 200:
62
+				$result = json_decode($result->body, true);
63
+				break;
64
+			case 204:
65
+				$result = "Success";
66
+				break;
67
+			case 401:
68 68
 				throw new \Exception('Unauthorized');
69
-                break;
70
-            case 404:
71
-                //echo "Es wurde bereits gevoted";
69
+				break;
70
+			case 404:
71
+				//echo "Es wurde bereits gevoted";
72 72
 			case 477:
73
-                //echo "Es wurde bereits gevoted";
74
-                //throw  new \Exception('Signing failed!');
75
-                break;
76
-            default:
77
-                throw  new \Exception('Unknown Error: '.$result->status_code);
78
-        }
73
+				//echo "Es wurde bereits gevoted";
74
+				//throw  new \Exception('Signing failed!');
75
+				break;
76
+			default:
77
+				throw  new \Exception('Unknown Error: '.$result->status_code);
78
+		}
79 79
 
80
-        if($device_uid != "")
81
-        {
80
+		if($device_uid != "")
81
+		{
82 82
 			$result[0] = $result;
83 83
 			$result[1] = $device_uid;
84 84
 		}
85 85
 
86
-        /*
86
+		/*
87 87
         var_dump($result);
88 88
         */
89 89
 
90
-        return $result;
91
-    }
92
-    abstract function getPayload();
93
-    /**
94
-     * Gets Sign headers
95
-     * @return array headers
96
-     */
97
-    private function getSignHeaders()
98
-    {
90
+		return $result;
91
+	}
92
+	abstract function getPayload();
93
+	/**
94
+	 * Gets Sign headers
95
+	 * @return array headers
96
+	 */
97
+	private function getSignHeaders()
98
+	{
99 99
 			if($this->getAccessToken() == null) {
100 100
 				$payload_accessToken = "";
101 101
 			}
@@ -104,54 +104,54 @@  discard block
 block discarded – undo
104 104
 			}
105 105
 			
106 106
 			
107
-        $headers = array(
108
-            "Connection" => "keep-alive",
109
-            "Accept-Encoding" => "gzip",
110
-            "Content-Type" => "application/json; charset=UTF-8",
111
-            "User-Agent" => self::USERAGENT
112
-        );
113
-        $timestamp = new DateTime();
114
-        $timestamp = $timestamp->format(DateTime::ATOM);
115
-        $timestamp = substr($timestamp, 0, -6);
116
-        $timestamp .= "Z";
117
-        $urlParts = parse_url($this->getFullUrl());
118
-        $url2 = "";
119
-        $req = [$this->getMethod(),
120
-            $urlParts['host'],
121
-            "443",
122
-            $urlParts['path'],
123
-            $payload_accessToken,
124
-            $timestamp,
125
-            $url2,
126
-            $this->payLoad];
127
-        $reqString = implode("%", $req);
128
-        $secret = self::SECRET;
129
-        $signature = hash_hmac('sha1', $reqString, $secret);
130
-        $signature = strtoupper($signature);
131
-        $headers['X-Authorization'] = 'HMAC ' . $signature;
132
-        $headers['X-Client-Type'] = self::CLIENT_TYPE;
133
-        $headers['X-Timestamp'] = $timestamp;
134
-        $headers['X-Api-Version'] = '0.2';
135
-        return $headers;
136
-    }
137
-    private function getFullUrl()
138
-    {
139
-        return self::APIURL . $this->getApiEndPoint();
140
-    }
141
-    abstract function getApiEndPoint();
142
-    abstract function getMethod();
143
-    /**
144
-     * @return string
145
-     */
146
-    private function getAccessToken()
147
-    {
148
-        return $this->accessToken;
149
-    }
150
-    /**
151
-     * @param string $accessToken
152
-     */
153
-    public function setAccessToken($accessToken)
154
-    {
155
-        $this->accessToken = $accessToken;
156
-    }
107
+		$headers = array(
108
+			"Connection" => "keep-alive",
109
+			"Accept-Encoding" => "gzip",
110
+			"Content-Type" => "application/json; charset=UTF-8",
111
+			"User-Agent" => self::USERAGENT
112
+		);
113
+		$timestamp = new DateTime();
114
+		$timestamp = $timestamp->format(DateTime::ATOM);
115
+		$timestamp = substr($timestamp, 0, -6);
116
+		$timestamp .= "Z";
117
+		$urlParts = parse_url($this->getFullUrl());
118
+		$url2 = "";
119
+		$req = [$this->getMethod(),
120
+			$urlParts['host'],
121
+			"443",
122
+			$urlParts['path'],
123
+			$payload_accessToken,
124
+			$timestamp,
125
+			$url2,
126
+			$this->payLoad];
127
+		$reqString = implode("%", $req);
128
+		$secret = self::SECRET;
129
+		$signature = hash_hmac('sha1', $reqString, $secret);
130
+		$signature = strtoupper($signature);
131
+		$headers['X-Authorization'] = 'HMAC ' . $signature;
132
+		$headers['X-Client-Type'] = self::CLIENT_TYPE;
133
+		$headers['X-Timestamp'] = $timestamp;
134
+		$headers['X-Api-Version'] = '0.2';
135
+		return $headers;
136
+	}
137
+	private function getFullUrl()
138
+	{
139
+		return self::APIURL . $this->getApiEndPoint();
140
+	}
141
+	abstract function getApiEndPoint();
142
+	abstract function getMethod();
143
+	/**
144
+	 * @return string
145
+	 */
146
+	private function getAccessToken()
147
+	{
148
+		return $this->accessToken;
149
+	}
150
+	/**
151
+	 * @param string $accessToken
152
+	 */
153
+	public function setAccessToken($accessToken)
154
+	{
155
+		$this->accessToken = $accessToken;
156
+	}
157 157
 }
Please login to merge, or discard this patch.
php/Requests/libary/Requests/Cookie/Jar.php 1 patch
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.