@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function setBaseURL($apiBaseURL) |
27 | 27 | { |
28 | - $this->_apiBaseURL = rtrim($apiBaseURL, '/') . '/'; |
|
28 | + $this->_apiBaseURL = rtrim($apiBaseURL, '/').'/'; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | protected function callAPI($resource, $method = "GET", $data = array(), $headers = array()) |
79 | 79 | { |
80 | 80 | $ch = curl_init(); |
81 | - curl_setopt($ch, CURLOPT_URL, $this->_apiBaseURL . ltrim($resource, '/')); |
|
81 | + curl_setopt($ch, CURLOPT_URL, $this->_apiBaseURL.ltrim($resource, '/')); |
|
82 | 82 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
83 | 83 | |
84 | 84 | // Explicitly empty null values, because http_build_query will throw away |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | $headerArray = array(); |
109 | 109 | foreach ($headers as $key => $value) { |
110 | - $headerArray[] = $key . ': ' . $value; |
|
110 | + $headerArray[] = $key.': '.$value; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | curl_setopt($ch, CURLOPT_HTTPHEADER, $headerArray); |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * @param boolean $temporary temporary failure? |
36 | 36 | * @param Exception $parent parent exception |
37 | 37 | */ |
38 | - public function __construct($message, $temporary=false, Exception $parent=null) |
|
38 | + public function __construct($message, $temporary = false, Exception $parent = null) |
|
39 | 39 | { |
40 | 40 | parent::__construct($message, $parent); |
41 | 41 | $this->_temporary = $temporary; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | * @param string $message exception message |
30 | 30 | * @param Exception $parent parent exception |
31 | 31 | */ |
32 | - public function __construct($message, $parent=null) |
|
32 | + public function __construct($message, $parent = null) |
|
33 | 33 | { |
34 | 34 | parent::__construct($message, 0, $parent); |
35 | 35 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * @param boolean $temporary temporary failure? |
36 | 36 | * @param Exception $parent parent exception |
37 | 37 | */ |
38 | - public function __construct($message, $temporary=false, Exception $parent=null) |
|
38 | + public function __construct($message, $temporary = false, Exception $parent = null) |
|
39 | 39 | { |
40 | 40 | parent::__construct($message, $parent); |
41 | 41 | $this->_temporary = $temporary; |
@@ -170,10 +170,10 @@ |
||
170 | 170 | } |
171 | 171 | |
172 | 172 | if ($timestamp + $tempBlockDuration * 60 < time()) { |
173 | - return false; // Temp block expired |
|
173 | + return false; // Temp block expired |
|
174 | 174 | } |
175 | 175 | } |
176 | - return true; // Blocked by temp block |
|
176 | + return true; // Blocked by temp block |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -128,7 +128,7 @@ |
||
128 | 128 | * |
129 | 129 | * Note that the $tempBlockDuration is specified in MINUTES |
130 | 130 | */ |
131 | - public function isBlocked(string $userId, int $tempBlockDuration=0): bool; |
|
131 | + public function isBlocked(string $userId, int $tempBlockDuration = 0): bool; |
|
132 | 132 | |
133 | 133 | /** |
134 | 134 | * Block or unblock the user account. |
@@ -29,7 +29,7 @@ |
||
29 | 29 | * @throws ReadWriteException |
30 | 30 | * @throws Exception |
31 | 31 | */ |
32 | - public function setValue(string $key, $value, int $expire=0): void; |
|
32 | + public function setValue(string $key, $value, int $expire = 0): void; |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Remove $key from the state storage |
@@ -81,7 +81,7 @@ |
||
81 | 81 | 'verifyResponse for user "%s" failed', |
82 | 82 | $userId |
83 | 83 | ), |
84 | - array( 'exception' => $e) |
|
84 | + array('exception' => $e) |
|
85 | 85 | ); |
86 | 86 | return false; |
87 | 87 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | public static function randomBytes(int $length): string |
43 | 43 | { |
44 | 44 | // Get $length cryptographically secure pseudo-random bytes |
45 | - $rnd=\random_bytes($length); |
|
45 | + $rnd = \random_bytes($length); |
|
46 | 46 | |
47 | 47 | if (strlen($rnd) !== $length) { |
48 | 48 | throw new Exception("random_bytes did not return the requested number of bytes"); |