Passed
Push — master ( 21e202...0aab8f )
by Petr
03:53
created

OrganizerController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 41
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A listAction() 0 6 1
A viewAction() 0 4 1
1
<?php
2
3
namespace AppBundle\Controller;
4
5
use AppBundle\Controller\Infrastructure\RestController;
6
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
7
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
8
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
9
use Symfony\Component\HttpFoundation\Response;
10
11
/**
12
 * @author Vehsamrak
13
 * @Route("organizer")
14
 */
15
class OrganizerController extends RestController
16
{
17
18
    /**
19
     * List all registered organizers
20
     * @Route("s/{limit}/{offset}", name="organizers_list")
21
     * @Method("GET")
22
     * @ApiDoc(
23
     *     section="Organizer",
24
     *     statusCodes={
25
     *         200="OK",
26
     *     }
27
     * )
28
     * @param int $limit Limit results. Default is 50
29
     * @param int $offset Starting serial number of result collection. Default is 0
30
     */
31 1
    public function listAction($limit = null, $offset = null): Response
32
    {
33 1
        return $this->respond(
34 1
            $this->createCompleteCollectionResponse($this->get('rockparade.organizer_repository'), $limit, $offset)
35
        );
36
    }
37
38
    /**
39
     * View organizer by name
40
     * @Route("/{organizerName}", name="organizer_view")
41
     * @Method("GET")
42
     * @ApiDoc(
43
     *     section="Organizer",
44
     *     statusCodes={
45
     *         200="Organizer was found",
46
     *         404="Organizer with given name was not found",
47
     *     }
48
     * )
49
     * @param string $organizerName organizer name
50
     */
51 2
    public function viewAction(string $organizerName): Response
52
    {
53 2
        return $this->viewEntity($this->get('rockparade.organizer_repository'), $organizerName);
54
    }
55
}
56