GuestSessionController::postGuests()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace App\Guests\Controller;
4
5
use App\Controller\BaseController;
6
use App\Guests\Entity\GuestSession;
7
use Symfony\Component\HttpFoundation\JsonResponse;
8
use Symfony\Component\Routing\Annotation\Route;
9
10
class GuestSessionController extends BaseController
11
{
12
    /**
13
     * @Route("/api/guests", methods={"POST"});
14
     *
15
     * @throws \Exception
16
     *
17
     * @return JsonResponse
18
     */
19 1
    public function postGuests()
20
    {
21 1
        $newGuestSession = new GuestSession();
22
23 1
        $em = $this->getDoctrine()->getManager();
24 1
        $em->persist($newGuestSession);
25 1
        $em->flush();
26
27 1
        return $this->response($newGuestSession);
28
    }
29
}
30