add more doc

This commit is contained in:
Philipp 2022-06-23 22:46:46 +02:00
parent 13783089e7
commit 12ba37e8d2
No known key found for this signature in database
GPG key ID: 24A7501396EB5432

View file

@ -40,6 +40,8 @@ class Request
/** /**
* @return string The remote IP address of the current request * @return string The remote IP address of the current request
*
* Do always use this instead of $_SERVER['REMOTE_ADDR']
*/ */
public function getRemoteAddress(): string public function getRemoteAddress(): string
{ {
@ -58,6 +60,10 @@ class Request
* Otherwise, $remoteAddress will be compared to $trustedProxy literally and the result * Otherwise, $remoteAddress will be compared to $trustedProxy literally and the result
* will be returned. * will be returned.
* *
* @param string $trustedProxy The current, trusted proxy to check
* @param string $remoteAddress The current remote IP address
*
*
* @return boolean true if $remoteAddress matches $trustedProxy, false otherwise * @return boolean true if $remoteAddress matches $trustedProxy, false otherwise
*/ */
protected function matchesTrustedProxy(string $trustedProxy, string $remoteAddress): bool protected function matchesTrustedProxy(string $trustedProxy, string $remoteAddress): bool
@ -80,6 +86,9 @@ class Request
* Checks if given $remoteAddress matches any entry in the given array $trustedProxies. * Checks if given $remoteAddress matches any entry in the given array $trustedProxies.
* For details regarding what "match" means, refer to `matchesTrustedProxy`. * For details regarding what "match" means, refer to `matchesTrustedProxy`.
* *
* @param string[] $trustedProxies A list of the trusted proxies
* @param string $remoteAddress The current remote IP address
*
* @return boolean true if $remoteAddress matches any entry in $trustedProxies, false otherwise * @return boolean true if $remoteAddress matches any entry in $trustedProxies, false otherwise
*/ */
protected function isTrustedProxy(array $trustedProxies, string $remoteAddress): bool protected function isTrustedProxy(array $trustedProxies, string $remoteAddress): bool
@ -94,6 +103,10 @@ class Request
} }
/** /**
* Determines the remote address, if the connection came from a trusted proxy
* and `forwarded_for_headers` has been configured then the IP address
* specified in this header will be returned instead.
*
* @param IManageConfigValues $config * @param IManageConfigValues $config
* @param array $server * @param array $server
* *