public function handle(ApiDoc $annotation, array $annotations, Route $route, \ReflectionMethod $method) { foreach ($annotations as $annot) { if ($annot instanceof PreAuthorize) { $annotation->setAuthentication(true); } elseif ($annot instanceof Secure) { $annotation->setAuthentication(true); $annotation->setAuthenticationRoles(is_array($annot->roles) ? $annot->roles : explode(',', $annot->roles)); } } }