@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Threema GmbH |
|
4 | - * @copyright Copyright (c) 2015 Threema GmbH |
|
5 | - */ |
|
3 | + * @author Threema GmbH |
|
4 | + * @copyright Copyright (c) 2015 Threema GmbH |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | |
8 | 8 | namespace Threema\Core; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param string $value |
39 | 39 | * @return $this |
40 | 40 | */ |
41 | - public function setValue($key, $value){ |
|
41 | + public function setValue($key, $value) { |
|
42 | 42 | $this->values[$key] = $value; |
43 | 43 | return $this; |
44 | 44 | } |
@@ -50,18 +50,18 @@ discard block |
||
50 | 50 | * @return $this |
51 | 51 | */ |
52 | 52 | public function addPath($path) { |
53 | - while(substr($this->path, strlen($this->path)-1) == '/') { |
|
53 | + while (substr($this->path, strlen($this->path)-1) == '/') { |
|
54 | 54 | $this->path = substr($this->path, 0, strlen($this->path)-1); |
55 | 55 | } |
56 | 56 | |
57 | 57 | $realPath = ''; |
58 | - foreach(explode('/', $path) as $c => $pathPiece) { |
|
59 | - if($c > 0) { |
|
58 | + foreach (explode('/', $path) as $c => $pathPiece) { |
|
59 | + if ($c > 0) { |
|
60 | 60 | $realPath .= '/'; |
61 | 61 | } |
62 | 62 | $realPath .= urlencode($pathPiece); |
63 | 63 | } |
64 | - while(substr($path, 0, 1) == '/') { |
|
64 | + while (substr($path, 0, 1) == '/') { |
|
65 | 65 | $path = substr($path, 1); |
66 | 66 | } |
67 | 67 | |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function getPath() { |
76 | 76 | $p = $this->path; |
77 | - if(count($this->values) > 0) { |
|
77 | + if (count($this->values) > 0) { |
|
78 | 78 | $s = http_build_query($this->values); |
79 | - if(strlen($s) > 0) { |
|
79 | + if (strlen($s) > 0) { |
|
80 | 80 | $p .= '?'.$s; |
81 | 81 | } |
82 | 82 | } |
@@ -100,17 +100,17 @@ discard block |
||
100 | 100 | { |
101 | 101 | $result = array(); |
102 | 102 | |
103 | - while(strlen($urlParameter) > 0) { |
|
103 | + while (strlen($urlParameter) > 0) { |
|
104 | 104 | // name |
105 | - $keyPosition= strpos($urlParameter,'='); |
|
106 | - $keyValue = substr($urlParameter,0,$keyPosition); |
|
105 | + $keyPosition = strpos($urlParameter, '='); |
|
106 | + $keyValue = substr($urlParameter, 0, $keyPosition); |
|
107 | 107 | // value |
108 | - $valuePosition = strpos($urlParameter,'&') ? strpos($urlParameter,'&'): strlen($urlParameter); |
|
109 | - $valueValue = substr($urlParameter,$keyPosition+1,$valuePosition-$keyPosition-1); |
|
108 | + $valuePosition = strpos($urlParameter, '&') ? strpos($urlParameter, '&') : strlen($urlParameter); |
|
109 | + $valueValue = substr($urlParameter, $keyPosition+1, $valuePosition-$keyPosition-1); |
|
110 | 110 | |
111 | 111 | // decoding the response |
112 | 112 | $result[$keyValue] = urldecode($valueValue); |
113 | - $urlParameter = substr($urlParameter,$valuePosition+1,strlen($urlParameter)); |
|
113 | + $urlParameter = substr($urlParameter, $valuePosition+1, strlen($urlParameter)); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | return $result; |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Threema GmbH |
|
4 | - * @copyright Copyright (c) 2015 Threema GmbH |
|
5 | - */ |
|
3 | + * @author Threema GmbH |
|
4 | + * @copyright Copyright (c) 2015 Threema GmbH |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | |
8 | 8 | namespace Threema\MsgApi\Commands; |
@@ -38,7 +38,7 @@ |
||
38 | 38 | * @param object $res |
39 | 39 | * @return CapabilityResult |
40 | 40 | */ |
41 | - function parseResult($httpCode, $res){ |
|
41 | + function parseResult($httpCode, $res) { |
|
42 | 42 | return new CapabilityResult($httpCode, $res); |
43 | 43 | } |
44 | 44 | } |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Threema GmbH |
|
4 | - * @copyright Copyright (c) 2015 Threema GmbH |
|
5 | - */ |
|
3 | + * @author Threema GmbH |
|
4 | + * @copyright Copyright (c) 2015 Threema GmbH |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | |
8 | 8 | namespace Threema\MsgApi\Commands; |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Threema GmbH |
|
4 | - * @copyright Copyright (c) 2015 Threema GmbH |
|
5 | - */ |
|
3 | + * @author Threema GmbH |
|
4 | + * @copyright Copyright (c) 2015 Threema GmbH |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | |
8 | 8 | namespace Threema\MsgApi\Commands; |
@@ -26,7 +26,7 @@ |
||
26 | 26 | * @param object $res |
27 | 27 | * @return CreditsResult |
28 | 28 | */ |
29 | - function parseResult($httpCode, $res){ |
|
29 | + function parseResult($httpCode, $res) { |
|
30 | 30 | return new CreditsResult($httpCode, $res); |
31 | 31 | } |
32 | 32 | } |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Threema GmbH |
|
4 | - * @copyright Copyright (c) 2015 Threema GmbH |
|
5 | - */ |
|
3 | + * @author Threema GmbH |
|
4 | + * @copyright Copyright (c) 2015 Threema GmbH |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | |
8 | 8 | namespace Threema\MsgApi\Commands; |
@@ -42,7 +42,7 @@ |
||
42 | 42 | * @param object $res |
43 | 43 | * @return FetchPublicKeyResult |
44 | 44 | */ |
45 | - function parseResult($httpCode, $res){ |
|
45 | + function parseResult($httpCode, $res) { |
|
46 | 46 | return new FetchPublicKeyResult($httpCode, $res); |
47 | 47 | } |
48 | 48 | } |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Threema GmbH |
|
4 | - * @copyright Copyright (c) 2015 Threema GmbH |
|
5 | - */ |
|
3 | + * @author Threema GmbH |
|
4 | + * @copyright Copyright (c) 2015 Threema GmbH |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | |
8 | 8 | namespace Threema\MsgApi\Commands; |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * @param object $res |
50 | 50 | * @return LookupIdResult |
51 | 51 | */ |
52 | - function parseResult($httpCode, $res){ |
|
52 | + function parseResult($httpCode, $res) { |
|
53 | 53 | return new LookupIdResult($httpCode, $res); |
54 | 54 | } |
55 | 55 | } |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Threema GmbH |
|
4 | - * @copyright Copyright (c) 2015 Threema GmbH |
|
5 | - */ |
|
3 | + * @author Threema GmbH |
|
4 | + * @copyright Copyright (c) 2015 Threema GmbH |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | |
8 | 8 | namespace Threema\MsgApi\Commands; |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * @param object $res |
50 | 50 | * @return LookupIdResult |
51 | 51 | */ |
52 | - function parseResult($httpCode, $res){ |
|
52 | + function parseResult($httpCode, $res) { |
|
53 | 53 | return new LookupIdResult($httpCode, $res); |
54 | 54 | } |
55 | 55 | } |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Threema GmbH |
|
4 | - * @copyright Copyright (c) 2015 Threema GmbH |
|
5 | - */ |
|
3 | + * @author Threema GmbH |
|
4 | + * @copyright Copyright (c) 2015 Threema GmbH |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | |
8 | 8 | namespace Threema\MsgApi\Commands; |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Threema GmbH |
|
4 | - * @copyright Copyright (c) 2015 Threema GmbH |
|
5 | - */ |
|
3 | + * @author Threema GmbH |
|
4 | + * @copyright Copyright (c) 2015 Threema GmbH |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | |
8 | 8 | namespace Threema\MsgApi\Commands\Results; |
@@ -78,7 +78,7 @@ |
||
78 | 78 | * @return string |
79 | 79 | */ |
80 | 80 | protected function getErrorMessageByErrorCode($httpCode) { |
81 | - switch($httpCode) { |
|
81 | + switch ($httpCode) { |
|
82 | 82 | case 401: |
83 | 83 | return 'API identity or secret incorrect'; |
84 | 84 | case 404: |