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

Read::__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
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