src/Sulu/Bundle/AudienceTargetingBundle/EventListener/AudienceTargetingCacheListener.php
private function requestTargetGroup(Request $request, CacheInvalidation $kernel, int $currentTargetGroup = null)
    {
        $targetGroupRequest = Request::create(
            static::TARGET_GROUP_URL,
            Request::METHOD_GET,
            [],
            [],
            [],
            $request->server->all()
        );

        if ($currentTargetGroup) {
            $targetGroupRequest->headers->set(static::TARGET_GROUP_HEADER, $currentTargetGroup);
        }

        $targetGroupRequest->headers->set(static::USER_CONTEXT_URL_HEADER, $request->getUri());

        $targetGroupResponse = $kernel->handle($targetGroupRequest);

        return $targetGroupResponse->headers->get(static::TARGET_GROUP_HEADER);
    }
private function requestTargetGroup(Request $request, CacheInvalidation $kernel, int $currentTargetGroup = null)
    {
        $targetGroupRequest = Request::create(
            static::TARGET_GROUP_URL,
            Request::METHOD_GET,
            [],
            [],
            [],
            $request->server->all()
        );

        if ($currentTargetGroup) {
            $targetGroupRequest->headers->set(static::TARGET_GROUP_HEADER, $currentTargetGroup);
        }

        $targetGroupRequest->headers->set(static::USER_CONTEXT_URL_HEADER, $request->getUri());

        $targetGroupResponse = $kernel->handle($targetGroupRequest);

        return $targetGroupResponse->headers->get(static::TARGET_GROUP_HEADER);
    }
private function requestTargetGroup ( Request $ request , CacheInvalidation $ kernel , int $ currentTargetGroup = null ) { $ targetGroupRequest = Request :: create ( static :: TARGET_GROUP_URL , Request :: METHOD_GET , [ ] , [ ] , [ ] , $ request -> server -> all ( ) ) ; if ( $ currentTargetGroup ) { $ targetGroupRequest -> headers -> set ( static :: TARGET_GROUP_HEADER , $ currentTargetGroup ) ; } $ targetGroupRequest -> headers -> set ( static :: USER_CONTEXT_URL_HEADER , $ request -> getUri ( ) ) ; $ targetGroupResponse = $ kernel -> handle ( $ targetGroupRequest ) ; return $ targetGroupResponse -> headers -> get ( static :: TARGET_GROUP_HEADER ) ; }
Sends a request to the application to determine the target group of the current visitor.

@param Request $request
@param CacheInvalidation $kernel
@param null|int $currentTargetGroup

@return string
Sends a request to the application to determine the target group of the current visitor .