/**
  * @param int $amount
  * @param FrontendUser[] $speakers
  * @param array $recurringSpeakersPerSessionPercentage
  * @return AcceptedSession[]
  */
 protected function createSessions($amount, array $speakers, array $recurringSpeakersPerSessionPercentage = [])
 {
     $sessions = [];
     for ($i = 1; $i <= $amount; $i++) {
         $randomSpeaker = $speakers[array_rand($speakers)];
         $session = new AcceptedSession();
         $session->_setProperty('uid', $i + 3000);
         $session->_setProperty('votes', rand(0, 500));
         $session->setTitle('Session #' . $i);
         $session->addSpeaker($randomSpeaker);
         $sessions[] = $session;
     }
     return $sessions;
 }
 /**
  * Checks if session topic would exceed max topics per time slot
  *
  * @param AcceptedSession $session
  * @param integer $dayIterator
  * @param integer $timeIndex
  * @return boolean
  */
 protected function checkMaxTopicsForTimeSlot(AcceptedSession $session, $dayIterator, $timeIndex)
 {
     $spotOk = true;
     $countDev = 0;
     $countDevOps = 0;
     $countDesign = 0;
     $countCommunity = 0;
     // Check topic for each room
     foreach ($this->matrix[$dayIterator][$timeIndex] as $otherRoom) {
         if ($otherRoom == '') {
             continue;
         }
         /**
          * @var AcceptedSession $otherRoom
          */
         switch ($otherRoom->getTopicGroup()->getTitle()) {
             case 'Dev':
                 $countDev++;
                 break;
             case 'DevOps':
                 $countDevOps++;
                 break;
             case 'Design':
                 $countDesign++;
                 break;
             case 'Community':
                 $countCommunity++;
                 break;
         }
     }
     switch ($session->getTopicGroup()->getTitle()) {
         case 'Dev':
             if ($countDev >= $this->maxDevSessionsByTimeslot) {
                 $spotOk = false;
             }
             break;
         case 'DevOps':
             if ($countDevOps >= $this->maxDevopsSessionsByTimeslot) {
                 $spotOk = false;
             }
             break;
         case 'Design':
             if ($countDesign >= $this->maxDesignSessionsByTimeslot) {
                 $spotOk = false;
             }
             break;
         case 'Community':
             if ($countDesign >= $this->maxCommunitySessionsByTimeslot) {
                 $spotOk = false;
             }
             break;
     }
     return $spotOk;
 }