/** * Get the values of trusted proxy header. * * @param string $type One of the HEADER_* constants * @param Request $request The request to get the trusted proxy header from * @return \Iterator An array of the values for this header type or NULL if this header type should not be trusted */ protected function getTrustedProxyHeaderValues($type, Request $request) { $trustedHeaders = isset($this->settings['headers'][$type]) ? $this->settings['headers'][$type] : ''; if ($trustedHeaders === '' || !$request->getAttribute(Request::ATTRIBUTE_TRUSTED_PROXY)) { (yield null); return; } $trustedHeaders = array_map('trim', explode(',', $trustedHeaders)); foreach ($trustedHeaders as $trustedHeader) { if ($request->hasHeader($trustedHeader)) { (yield array_map('trim', explode(',', $request->getHeader($trustedHeader)))); } } (yield null); }