public function handle(GetResponseEvent $event)
 {
     if (null !== $this->tokenStorage->getToken()) {
         return;
     }
     $this->tokenStorage->setToken(new AnonymousToken($this->key, NULLUser::getInstance(), []));
 }
 public function add(QuestionSheet $sheet)
 {
     if (NULLUser::getInstance() === $sheet->getOwner()) {
         throw new \InvalidArgumentException("incorrect user");
     }
     $this->entityManager->persist($sheet);
     $this->entityManager->flush();
 }
 protected function incorrectInput($object, $user)
 {
     return !$object instanceof QuestionSheet || $user === NULLUser::getInstance();
 }