/**
  * @param FilterResponseEvent $event
  */
 public function onKernelResponse(FilterResponseEvent $event)
 {
     if (!$event->isMasterRequest()) {
         return;
     }
     $request = $event->getRequest();
     $response = $event->getResponse();
     if (substr((string) $response->getStatusCode(), 0, 1) !== '2') {
         // TODO UT this
         return;
     }
     if (RequestListener::isModifyingMethodRequest($request)) {
         $version = $this->store->update($request, (string) microtime(true));
     } elseif (!RequestListener::isIgnoreMethodRequest($request)) {
         if (!($version = $this->store->fetch($request))) {
             $version = $this->store->register($request, (string) microtime(true));
         }
     }
     if (isset($version)) {
         $response->headers->set('ETag', $version);
     }
 }
 /**
  * @test
  */
 public function registerWillNotUpdateVersionOfExistingParent()
 {
     $parentUri = "/a/b";
     $parentVersion = microtime(true);
     $this->store->update(Request::create($parentUri), $parentVersion);
     $childUri = "/a/b/cee/dee/?eff=gee";
     $childVersion = microtime(true);
     $this->store->register(Request::create($childUri), $childVersion);
     $this->assertSame($parentVersion, $this->store->fetch(Request::create("/a")));
     $this->assertSame($parentVersion, $this->store->fetch(Request::create("/a/b")));
     $this->assertSame($childVersion, $this->store->fetch(Request::create("/a/b/cee")));
     $this->assertSame($childVersion, $this->store->fetch(Request::create("/a/b/cee/dee")));
     $this->assertSame($childVersion, $this->store->fetch(Request::create("/a/b/cee/dee/?eff=gee")));
 }