Exemple #1
0
 /**
  * Picks the topic with given id.
  *
  * @param string $id
  *
  * @return array A topic as an array with the following keys:
  *               id, title, description and average.
  *
  * @throws NonExistentIdApiException
  */
 public function pick($id)
 {
     try {
         return $this->pickTopicInternalWorker->pick($id);
     } catch (NonExistentIdInternalException $e) {
         throw new NonExistentIdApiException();
     }
 }
 /**
  * Validates given topics.
  *
  * @throws NoTopicsInternalException
  * @throws NonExistentTopicInternalException
  */
 public function validate($topics)
 {
     if (count($topics) == 0) {
         throw new NoTopicsInternalException();
     }
     foreach ($topics as $topic) {
         try {
             $this->pickTopicInternalWorker->pick($topic);
         } catch (NonExistentIdInternalException $e) {
             throw new NonExistentTopicInternalException();
         }
     }
 }