Passed
Push — develop ( c95ce3...d0c957 )
by BENARD
22:42 queued 19:38
created

ReadForum::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ProjetNormandie\ForumBundle\Controller;
6
7
use ProjetNormandie\ForumBundle\Entity\Forum;
8
use ProjetNormandie\ForumBundle\Service\MarkAsReadService;
9
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
10
use Symfony\Component\HttpFoundation\JsonResponse;
11
12
class ReadForum extends AbstractController
13
{
14
    private MarkAsReadService $markAsReadService;
15
16
    public function __construct(MarkAsReadService $markAsReadService)
17
    {
18
        $this->markAsReadService = $markAsReadService;
19
    }
20
21
22
    /**
23
     * @param Forum $forum
24
     * @return JsonResponse
25
     */
26
    public function __invoke(Forum $forum): JsonResponse
27
    {
28
        $this->markAsReadService->readForum($forum);
29
        return new JsonResponse(['sucess' => true]);
30
    }
31
}
32