@@ -31,5 +31,5 @@ |
||
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 |
@@ -1,6 +1,6 @@ discard block |
||
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 |
||
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', |
@@ -12,7 +12,7 @@ |
||
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 | } |
@@ -36,7 +36,7 @@ |
||
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; |
@@ -7,22 +7,22 @@ discard block |
||
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 |
||
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; |
@@ -28,7 +28,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 != "") |
@@ -36,7 +36,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -31,5 +31,5 @@ |
||
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 |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | * @param array|null $args Array of user and password. Must have exactly two elements |
56 | 56 | */ |
57 | 57 | public function __construct($args = null) { |
58 | - if (is_string($args)) { |
|
58 | + if(is_string($args)) { |
|
59 | 59 | $this->proxy = $args; |
60 | 60 | } |
61 | - elseif (is_array($args)) { |
|
62 | - if (count($args) == 1) { |
|
61 | + elseif(is_array($args)) { |
|
62 | + if(count($args) == 1) { |
|
63 | 63 | list($this->proxy) = $args; |
64 | 64 | } |
65 | - elseif (count($args) == 3) { |
|
65 | + elseif(count($args) == 3) { |
|
66 | 66 | list($this->proxy, $this->user, $this->pass) = $args; |
67 | 67 | $this->use_authentication = true; |
68 | 68 | } |
@@ -82,12 +82,12 @@ discard block |
||
82 | 82 | * @see fsockopen_header |
83 | 83 | * @param Requests_Hooks $hooks Hook system |
84 | 84 | */ |
85 | - public function register(Requests_Hooks &$hooks) { |
|
85 | + public function register(Requests_Hooks&$hooks) { |
|
86 | 86 | $hooks->register('curl.before_send', array(&$this, 'curl_before_send')); |
87 | 87 | |
88 | 88 | $hooks->register('fsockopen.remote_socket', array(&$this, 'fsockopen_remote_socket')); |
89 | 89 | $hooks->register('fsockopen.remote_host_path', array(&$this, 'fsockopen_remote_host_path')); |
90 | - if ($this->use_authentication) { |
|
90 | + if($this->use_authentication) { |
|
91 | 91 | $hooks->register('fsockopen.after_headers', array(&$this, 'fsockopen_header')); |
92 | 92 | } |
93 | 93 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | curl_setopt($handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); |
103 | 103 | curl_setopt($handle, CURLOPT_PROXY, $this->proxy); |
104 | 104 | |
105 | - if ($this->use_authentication) { |
|
105 | + if($this->use_authentication) { |
|
106 | 106 | curl_setopt($handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY); |
107 | 107 | curl_setopt($handle, CURLOPT_PROXYUSERPWD, $this->get_auth_string()); |
108 | 108 | } |