ResultApiController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
dl 0
loc 32
rs 10
c 2
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A activeEventAction() 0 3 1
A semestersAction() 0 5 1
A participantsAction() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the thealternativezurich/feedback project.
5
 *
6
 * (c) Florian Moser <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace App\Controller\Administration\Semester\Event;
13
14
use App\Controller\Base\BaseApiController;
15
use App\Entity\Event;
16
use App\Entity\Semester;
17
use Symfony\Component\HttpFoundation\JsonResponse;
18
use Symfony\Component\Routing\Annotation\Route;
19
20
/**
21
 * @Route("/result/api")
22
 */
23
class ResultApiController extends BaseApiController
24
{
25
    /**
26
     * @Route("/active", name="administration_semester_event_result_api_active")
27
     *
28
     * @return JsonResponse
29
     */
30
    public function activeEventAction(Event $event)
31
    {
32
        return $this->returnEvent($event);
33
    }
34
35
    /**
36
     * @Route("/{event2}/participants", name="administration_semester_event_result_api_participants")
37
     *
38
     * @return JsonResponse
39
     */
40
    public function participantsAction(Event $event)
41
    {
42
        return $this->returnParticipant($event->getParticipants());
43
    }
44
45
    /**
46
     * @Route("/semesters", name="administration_semester_event_result_api_semesters")
47
     *
48
     * @return JsonResponse
49
     */
50
    public function semestersAction()
51
    {
52
        $semesters = $this->getDoctrine()->getRepository(Semester::class)->findBy([], ['name' => 'DESC']);
53
54
        return $this->returnSemester($semesters);
55
    }
56
}
57