private function getKey(FilterControllerEvent $event, RateLimit $rateLimit, array $annotations)
 {
     $request = $event->getRequest();
     $controller = $event->getController();
     $rateLimitMethods = join("", $rateLimit->getMethods());
     $rateLimitAlias = count($annotations) === 0 ? $this->pathLimitProcessor->getMatchedPath($request) : get_class($controller[0]) . ':' . $controller[1];
     // Create an initial key by joining the methods and the alias
     $key = $rateLimitMethods . ':' . $rateLimitAlias;
     // Let listeners manipulate the key
     $keyEvent = new GenerateKeyEvent($event->getRequest(), $key);
     $this->eventDispatcher->dispatch(RateLimitEvents::GENERATE_KEY, $keyEvent);
     return $keyEvent->getKey();
 }
 /** @test */
 function itReturnsTheCorrectMatchedPathForSubPaths()
 {
     $plp = new PathLimitProcessor(array('api' => array('path' => 'api/', 'methods' => array('GET'), 'limit' => 100, 'period' => 60)));
     $path = $plp->getMatchedPath(Request::create('/api/users/emails', 'GET'));
     $this->assertEquals('api', $path);
 }