Passed
Push — develop ( 15b005...6c07e4 )
by BENARD
02:30
created

Read   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 4 1
1
<?php
2
3
namespace ProjetNormandie\ForumBundle\Controller\Forum;
4
5
use ProjetNormandie\ForumBundle\Entity\Forum;
6
use ProjetNormandie\ForumBundle\Service\MarkAsReadService;
7
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
8
use Symfony\Component\HttpFoundation\JsonResponse;
9
10
class Read extends AbstractController
11
{
12
    private MarkAsReadService $markAsReadService;
13
14
    public function __construct(MarkAsReadService $markAsReadService)
15
    {
16
        $this->markAsReadService = $markAsReadService;
17
    }
18
19
20
    /**
21
     * @param Forum $forum
22
     * @return JsonResponse
23
     */
24
    public function __invoke(Forum $forum): JsonResponse
25
    {
26
        $this->markAsReadService->readForum($forum);
27
        return new JsonResponse(['sucess' => true]);
28
    }
29
}
30