Changed parameter name and added parameter phpDocs description.

This commit is contained in:
Simon Sessingø
2021-03-25 14:24:50 +01:00
parent d9cfa71534
commit cf1c59aee0
+3 -3
View File
@@ -215,13 +215,13 @@ class Request
* Get id address * Get id address
* If $safe is false, this function will detect Proxys. But the user can edit this header to whatever he wants! * If $safe is false, this function will detect Proxys. But the user can edit this header to whatever he wants!
* https://stackoverflow.com/questions/3003145/how-to-get-the-client-ip-address-in-php#comment-25086804 * https://stackoverflow.com/questions/3003145/how-to-get-the-client-ip-address-in-php#comment-25086804
* @param bool $safe * @param bool $safeMode When enabled, only safe non-spoofable headers will be returned. Note this can cause issues when using proxy.
* @return string|null * @return string|null
*/ */
public function getIp(bool $safe = false): ?string public function getIp(bool $safeMode = false): ?string
{ {
$headers = ['remote-addr']; $headers = ['remote-addr'];
if($safe === false) { if($safeMode === false) {
$headers = array_merge($headers, [ $headers = array_merge($headers, [
'http-cf-connecting-ip', 'http-cf-connecting-ip',
'http-client-ip', 'http-client-ip',