| Total Complexity | 5 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | class ApiController extends BaseApiController |
||
| 24 | { |
||
| 25 | /** |
||
| 26 | * @Route("/active_event", name="api_active_event") |
||
| 27 | * |
||
| 28 | * @return JsonResponse |
||
| 29 | */ |
||
| 30 | public function activeEventAction() |
||
| 31 | { |
||
| 32 | $now = new \DateTime(); |
||
| 33 | $today = $now->format('Y-m-d'); |
||
| 34 | $time = $now->format('H:i'); |
||
| 35 | |||
| 36 | $events = $this->getDoctrine()->getRepository(Event::class)->findBy(['date' => $today]); |
||
| 37 | foreach ($events as $event) { |
||
| 38 | if ($event->getFeedbackStartTime() < $time && $event->getFeedbackEndTime() > $time) { |
||
| 39 | $event->loadTemplateIfSafe($this->getParameter('PUBLIC_DIR')); |
||
| 40 | |||
| 41 | return $this->returnEvent($event); |
||
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 45 | return $this->returnEvent(null); |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @Route("/semesters", name="api_semesters") |
||
| 50 | * |
||
| 51 | * @return JsonResponse |
||
| 52 | */ |
||
| 53 | public function semestersAction() |
||
| 58 | } |
||
| 59 | } |
||
| 60 |