/**
  * @param string $authentication A hash of the shared secret and the params.
  * @param string $userIdentifier
  * @param string $subject Which subject to filter by.
  *
  * @throws \Exception
  */
 public function quizListAction($authentication, $userIdentifier, $subject = '')
 {
     if (!$this->verifyAuthentication($authentication, (string) ($userIdentifier . $subject))) {
         throw new AccessDeniedException('Access denied');
     }
     if ($this->requireSecure && !$this->request->getHttpRequest()->isSecure()) {
         throw new \Exception('Connection must be secure', 40);
     }
     $user = $this->userRepository->findByIdentifier($userIdentifier);
     $userQuizzes = $this->quizRepository->findAllByUser($user);
     $publicQuizzes = $this->quizRepository->findAllPublic();
     $out = array();
     foreach ($userQuizzes as $quiz) {
         $outQuiz = $this->makeExportArrayFromQuiz($quiz);
         $out[$this->persistenceManager->getIdentifierByObject($quiz)] = $outQuiz;
     }
     $out2 = array();
     foreach ($publicQuizzes as $quiz) {
         // No duplicates.
         if (isset($out[$this->persistenceManager->getIdentifierByObject($quiz)])) {
             continue;
         }
         $outQuiz = $this->makeExportArrayFromQuiz($quiz);
         $out2[$this->persistenceManager->getIdentifierByObject($quiz)] = $outQuiz;
     }
     $this->view->assign('value', array('userQuizzes' => $out, 'publicQuizzes' => $out2));
 }
 /**
  *
  * test
  */
 public function canLoginWithTokenAndUserIsCreated()
 {
     $this->login();
     //$this->assertContains('<!DOCTYPE html>', $response->getContent());
     //$this->assertEquals('200 OK', $response->getStatus());
     $user = $this->userRepository->findByIdentifier($this->token);
 }