public function onKernelEarlyRequest(GetResponseEvent $e)
    {
        $request = $e->getRequest();

        foreach ($this->pathConfig as $regex => $config) {
            if (preg_match($regex, $request->getPathInfo())) {
                $this->enabled = true;

                if (!$this->subscribed) {
                    $e->getDispatcher()->addSubscriber($this);
                    $this->subscribed = true;
                }

                //set other relevant values for this request
                $config['suppress_response_codes'] = ($config['allow_code_suppression']) ? $request->query->get('_suppress_codes', false) : false;
                $config['http_response_format'] = $request->get('_format', false);
                $config['negotiated'] = false;

                //subsequent listeners will check the request attributes for relevant configuration
                $request->attributes->set('_ac_web_service', $config);

                return;
            }
        }

        $this->enabled = false;
    }
public function onKernelEarlyRequest(GetResponseEvent $e)
    {
        $request = $e->getRequest();

        foreach ($this->pathConfig as $regex => $config) {
            if (preg_match($regex, $request->getPathInfo())) {
                $this->enabled = true;

                if (!$this->subscribed) {
                    $e->getDispatcher()->addSubscriber($this);
                    $this->subscribed = true;
                }

                //set other relevant values for this request
                $config['suppress_response_codes'] = ($config['allow_code_suppression']) ? $request->query->get('_suppress_codes', false) : false;
                $config['http_response_format'] = $request->get('_format', false);
                $config['negotiated'] = false;

                //subsequent listeners will check the request attributes for relevant configuration
                $request->attributes->set('_ac_web_service', $config);

                return;
            }
        }

        $this->enabled = false;
    }
public function onKernelEarlyRequest ( GetResponseEvent $ e ) { $ request = $ e -> getRequest ( ) ; foreach ( $ this -> pathConfig as $ regex => $ config ) { if ( preg_match ( $ regex , $ request -> getPathInfo ( ) ) ) { $ this -> enabled = true ; if ( ! $ this -> subscribed ) { $ e -> getDispatcher ( ) -> addSubscriber ( $ this ) ; $ this -> subscribed = true ; } //set other relevant values for this request $ config [ 'suppress_response_codes' ] = ( $ config [ 'allow_code_suppression' ] ) ? $ request -> query -> get ( '_suppress_codes' , false ) : false ; $ config [ 'http_response_format' ] = $ request -> get ( '_format' , false ) ; $ config [ 'negotiated' ] = false ; //subsequent listeners will check the request attributes for relevant configuration $ request -> attributes -> set ( '_ac_web_service' , $ config ) ; return ; } } $ this -> enabled = false ; }
Listens early in the `kernel.request` cycle for incoming requests and checks for a matching path.  If a
match is found, the rest of the kernel listeners are registered and the relevant path config is stored
for use in those listeners.
Listens early in the kernel . request cycle for incoming requests and checks for a matching path . If a match is found the rest of the kernel listeners are registered and the relevant path config is stored for use in those listeners .