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

OrganizerController::viewAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 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