@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | $this->setLocalPSLName($this->url); |
55 | 55 | if (null === $this->url) { |
56 | - $this->url = file_exists(__DIR__ . $this->localPSL) ? $this->localPSL : $this->sourceURL; |
|
56 | + $this->url = file_exists(__DIR__.$this->localPSL) ? $this->localPSL : $this->sourceURL; |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | $this->tree = array(); |
77 | 77 | $list = $this->readPSL(); |
78 | 78 | |
79 | - if (false===$list) { |
|
80 | - $e = new \RuntimeException('Cannot read ' . $this->url); |
|
79 | + if (false === $list) { |
|
80 | + $e = new \RuntimeException('Cannot read '.$this->url); |
|
81 | 81 | throw $e; |
82 | 82 | } |
83 | 83 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function getTree() |
161 | 161 | { |
162 | - if (null===$this->tree) { |
|
162 | + if (null === $this->tree) { |
|
163 | 163 | $this->loadTree(); |
164 | 164 | } |
165 | 165 | return $this->tree; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $parts = parse_url($this->url); |
177 | 177 | $remote = isset($parts['scheme']) || isset($parts['host']); |
178 | 178 | // try to read with file_get_contents |
179 | - $newPSL = file_get_contents(($remote ? '' : __DIR__) . $this->url); |
|
179 | + $newPSL = file_get_contents(($remote ? '' : __DIR__).$this->url); |
|
180 | 180 | if (false !== $newPSL) { |
181 | 181 | if ($remote) { |
182 | 182 | $this->saveLocalPSL($newPSL); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | // try again with curl if file_get_contents failed |
188 | - if (function_exists('curl_init') && false !== ($curlHandle = curl_init())) { |
|
188 | + if (function_exists('curl_init') && false !== ($curlHandle = curl_init())) { |
|
189 | 189 | curl_setopt($curlHandle, CURLOPT_URL, $this->url); |
190 | 190 | curl_setopt($curlHandle, CURLOPT_FAILONERROR, true); |
191 | 191 | curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, 1); |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | */ |
212 | 212 | protected function getCacheFileName($url) |
213 | 213 | { |
214 | - return __DIR__ . $this->dataDir . $this->cachedPrefix . md5($url); |
|
214 | + return __DIR__.$this->dataDir.$this->cachedPrefix.md5($url); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | */ |
253 | 253 | protected function saveLocalPSL($fileContents) |
254 | 254 | { |
255 | - return file_put_contents(__DIR__ . $this->localPSL, $fileContents); |
|
255 | + return file_put_contents(__DIR__.$this->localPSL, $fileContents); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | } |
270 | 270 | $parts = parse_url($url); |
271 | 271 | $fileName = basename($parts['path']); |
272 | - $this->localPSL = $this->dataDir . $fileName; |
|
272 | + $this->localPSL = $this->dataDir.$fileName; |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | /** |
@@ -281,14 +281,14 @@ discard block |
||
281 | 281 | */ |
282 | 282 | public function clearDataDirectory($cacheOnly = false) |
283 | 283 | { |
284 | - $dir = __DIR__ . $this->dataDir; |
|
284 | + $dir = __DIR__.$this->dataDir; |
|
285 | 285 | if (is_dir($dir)) { |
286 | 286 | if ($dirHandle = opendir($dir)) { |
287 | 287 | while (($file = readdir($dirHandle)) !== false) { |
288 | - if (filetype($dir . $file) === 'file' |
|
288 | + if (filetype($dir.$file) === 'file' |
|
289 | 289 | && (false === $cacheOnly || $this->startsWith($file, $this->cachedPrefix))) |
290 | 290 | { |
291 | - unlink($dir . $file); |
|
291 | + unlink($dir.$file); |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | closedir($dirHandle); |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | |
55 | 55 | $RandomCompatDIR = dirname(__FILE__); |
56 | 56 | |
57 | -require_once $RandomCompatDIR . '/byte_safe_strings.php'; |
|
58 | -require_once $RandomCompatDIR . '/cast_to_int.php'; |
|
59 | -require_once $RandomCompatDIR . '/error_polyfill.php'; |
|
57 | +require_once $RandomCompatDIR.'/byte_safe_strings.php'; |
|
58 | +require_once $RandomCompatDIR.'/cast_to_int.php'; |
|
59 | +require_once $RandomCompatDIR.'/error_polyfill.php'; |
|
60 | 60 | |
61 | 61 | if (!is_callable('random_bytes')) { |
62 | 62 | /** |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | if (extension_loaded('libsodium')) { |
77 | 77 | // See random_bytes_libsodium.php |
78 | 78 | if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) { |
79 | - require_once $RandomCompatDIR . '/random_bytes_libsodium.php'; |
|
79 | + require_once $RandomCompatDIR.'/random_bytes_libsodium.php'; |
|
80 | 80 | } elseif (method_exists('Sodium', 'randombytes_buf')) { |
81 | - require_once $RandomCompatDIR . '/random_bytes_libsodium_legacy.php'; |
|
81 | + require_once $RandomCompatDIR.'/random_bytes_libsodium_legacy.php'; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | // place, that is not helpful to us here. |
118 | 118 | |
119 | 119 | // See random_bytes_dev_urandom.php |
120 | - require_once $RandomCompatDIR . '/random_bytes_dev_urandom.php'; |
|
120 | + require_once $RandomCompatDIR.'/random_bytes_dev_urandom.php'; |
|
121 | 121 | } |
122 | 122 | // Unset variables after use |
123 | 123 | $RandomCompat_basedir = null; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | extension_loaded('mcrypt') |
160 | 160 | ) { |
161 | 161 | // See random_bytes_mcrypt.php |
162 | - require_once $RandomCompatDIR . '/random_bytes_mcrypt.php'; |
|
162 | + require_once $RandomCompatDIR.'/random_bytes_mcrypt.php'; |
|
163 | 163 | } |
164 | 164 | $RandomCompatUrandom = null; |
165 | 165 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1'); |
185 | 185 | if (method_exists($RandomCompatCOMtest, 'GetRandom')) { |
186 | 186 | // See random_bytes_com_dotnet.php |
187 | - require_once $RandomCompatDIR . '/random_bytes_com_dotnet.php'; |
|
187 | + require_once $RandomCompatDIR.'/random_bytes_com_dotnet.php'; |
|
188 | 188 | } |
189 | 189 | } catch (com_exception $e) { |
190 | 190 | // Don't try to use it. |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | } |
220 | 220 | |
221 | 221 | if (!is_callable('random_int')) { |
222 | - require_once $RandomCompatDIR . '/random_int.php'; |
|
222 | + require_once $RandomCompatDIR.'/random_int.php'; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | $RandomCompatDIR = null; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | ); |
52 | 52 | } |
53 | 53 | |
54 | - return (int) mb_strlen($binary_string, '8bit'); |
|
54 | + return (int)mb_strlen($binary_string, '8bit'); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | } else { |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | 'RandomCompat_strlen() expects a string' |
74 | 74 | ); |
75 | 75 | } |
76 | - return (int) strlen($binary_string); |
|
76 | + return (int)strlen($binary_string); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | return ''; |
134 | 134 | } |
135 | 135 | |
136 | - return (string) mb_substr($binary_string, $start, $length, '8bit'); |
|
136 | + return (string)mb_substr($binary_string, $start, $length, '8bit'); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | } else { |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | ); |
173 | 173 | } |
174 | 174 | |
175 | - return (string) substr($binary_string, $start, $length); |
|
175 | + return (string)substr($binary_string, $start, $length); |
|
176 | 176 | } |
177 | 177 | |
178 | - return (string) substr($binary_string, $start); |
|
178 | + return (string)substr($binary_string, $start); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | if ($max === $min) { |
81 | - return (int) $min; |
|
81 | + return (int)$min; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -185,6 +185,6 @@ discard block |
||
185 | 185 | */ |
186 | 186 | } while (!is_int($val) || $val > $max || $val < $min); |
187 | 187 | |
188 | - return (int) $val; |
|
188 | + return (int)$val; |
|
189 | 189 | } |
190 | 190 | } |
@@ -141,7 +141,7 @@ |
||
141 | 141 | /** |
142 | 142 | * @var string|bool |
143 | 143 | */ |
144 | - $buf = $buf . $read; |
|
144 | + $buf = $buf.$read; |
|
145 | 145 | } while ($remaining > 0); |
146 | 146 | |
147 | 147 | /** |
@@ -70,10 +70,10 @@ |
||
70 | 70 | $n = ($bytes - $i) > 1073741824 |
71 | 71 | ? 1073741824 |
72 | 72 | : $bytes - $i; |
73 | - $buf .= Sodium::randombytes_buf((int) $n); |
|
73 | + $buf .= Sodium::randombytes_buf((int)$n); |
|
74 | 74 | } |
75 | 75 | } else { |
76 | - $buf .= Sodium::randombytes_buf((int) $bytes); |
|
76 | + $buf .= Sodium::randombytes_buf((int)$bytes); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | if (is_string($buf)) { |
@@ -60,11 +60,11 @@ |
||
60 | 60 | && |
61 | 61 | $number < PHP_INT_MAX |
62 | 62 | ) { |
63 | - $number = (int) $number; |
|
63 | + $number = (int)$number; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | if (is_int($number)) { |
67 | - return (int) $number; |
|
67 | + return (int)$number; |
|
68 | 68 | } elseif (!$fail_open) { |
69 | 69 | throw new TypeError( |
70 | 70 | 'Expected an integer.' |
@@ -2,5 +2,5 @@ |
||
2 | 2 | |
3 | 3 | require "lib/password.php"; |
4 | 4 | |
5 | -echo "Test for functionality of compat library: " . (PasswordCompat\binary\check() ? "Pass" : "Fail"); |
|
5 | +echo "Test for functionality of compat library: ".(PasswordCompat\binary\check() ? "Pass" : "Fail"); |
|
6 | 6 | echo "\n"; |
7 | 7 | \ No newline at end of file |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | return null; |
39 | 39 | } |
40 | 40 | if (is_null($password) || is_int($password)) { |
41 | - $password = (string) $password; |
|
41 | + $password = (string)$password; |
|
42 | 42 | } |
43 | 43 | if (!is_string($password)) { |
44 | 44 | trigger_error("password_hash(): Password must be a string", E_USER_WARNING); |
45 | 45 | return null; |
46 | 46 | } |
47 | 47 | if (!is_int($algo)) { |
48 | - trigger_error("password_hash() expects parameter 2 to be long, " . gettype($algo) . " given", E_USER_WARNING); |
|
48 | + trigger_error("password_hash() expects parameter 2 to be long, ".gettype($algo)." given", E_USER_WARNING); |
|
49 | 49 | return null; |
50 | 50 | } |
51 | 51 | $resultLength = 0; |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | case 'integer': |
80 | 80 | case 'double': |
81 | 81 | case 'string': |
82 | - $salt = (string) $options['salt']; |
|
82 | + $salt = (string)$options['salt']; |
|
83 | 83 | break; |
84 | 84 | case 'object': |
85 | 85 | if (method_exists($options['salt'], '__tostring')) { |
86 | - $salt = (string) $options['salt']; |
|
86 | + $salt = (string)$options['salt']; |
|
87 | 87 | break; |
88 | 88 | } |
89 | 89 | case 'array': |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | } |
151 | 151 | $salt = PasswordCompat\binary\_substr($salt, 0, $required_salt_len); |
152 | 152 | |
153 | - $hash = $hash_format . $salt; |
|
153 | + $hash = $hash_format.$salt; |
|
154 | 154 | |
155 | 155 | $ret = crypt($password, $hash); |
156 | 156 |